<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- saved from url=(0090)http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Programmatically disable/enable Windows firewall - CodeProject</title> 
	<link type="text/css" rel="stylesheet" href="./Programmatically disable enable Windows firewall - CodeProject_files/CodeProject.min.css">

	
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 


<meta name="Description" content="This article teaches you how to disable and enable your Windows firewall programmatically.; Author: petersunde; Updated: 24 Jan 2007; Section: Internet / Network; Chapter: General Programming; Updated: 24 Jan 2007">
<meta name="Keywords" content="VB, Windows, .NET, Visual-Studio, Dev, Intermediate,Internet / Network,General Programming,Free source code, tutorials">
<meta name="Author" content="petersunde">
<meta name="Rating" content="General">
<meta name="Robots" content="index, follow, NOODP">
<meta name="Revisit-After" content="1 days">
<meta name="application-name" content="The Code Project">

<meta name="msapplication-navbutton-color" content="#FF9900">
<meta name="msapplication-tooltip" content="Your Development Resource.">
<meta name="msapplication-starturl" content="http://www.codeproject.com/?pinned=true">
<meta name="msapplication-task" content="name=Homepage;action-uri=http://www.codeproject.com/;icon-uri=http://www.codeproject.com/favico.ico">
<meta name="msapplication-task" content="name=Latest Articles;action-uri=http://www.codeproject.com/script/articles/Latest.aspx;icon-uri=http://www.codeproject.com/favico.ico">
<meta name="msapplication-task" content="name=Questions and Answers;action-uri=http://www.codeproject.com/script/Answers/;icon-uri=http://www.codeproject.com/favico.ico">
<meta name="msapplication-task" content="name=The Lounge;action-uri=http://www.codeproject.com/Lounge.aspx;icon-uri=http://www.codeproject.com/favico.ico">

<link rel="dns-prefetch" href="http://ajax.googleapis.com/"> 
<link rel="canonical" href="./Programmatically disable enable Windows firewall - CodeProject_files/Programmatically disable enable Windows firewall - CodeProject.htm">


<link rel="alternate" type="application/rss+xml" title="CodeProject Latest articles - All Topics" href="http://www.codeproject.com/WebServices/ArticleRSS.aspx?cat=1">
<link rel="alternate" type="application/rss+xml" title="CodeProject Latest articles - MFC/C++" href="http://www.codeproject.com/WebServices/ArticleRSS.aspx?cat=2">
<link rel="alternate" type="application/rss+xml" title="CodeProject Latest articles - C#" href="http://www.codeproject.com/WebServices/ArticleRSS.aspx?cat=3">
<link rel="alternate" type="application/rss+xml" title="CodeProject Latest articles - VB.NET" href="http://www.codeproject.com/WebServices/ArticleRSS.aspx?cat=6">
<link rel="alternate" type="application/rss+xml" title="CodeProject Latest articles - Mobile" href="http://www.codeproject.com/WebServices/ArticleRSS.aspx?cat=18">
<link rel="alternate" type="application/rss+xml" title="CodeProject Latest articles - ASP.NET" href="http://www.codeproject.com/WebServices/ArticleRSS.aspx?cat=4">
<link rel="alternate" type="application/rss+xml" title="CodeProject Lounge Postings" href="http://www.codeproject.com/webservices/LoungeRSS.aspx">
<link rel="search" type="application/opensearchdescription+xml" title="CodeProject" href="http://www.codeproject.com/info/OpenSearch.xml">

	<!--<base target="_top">--><base href="." target="_top">
	<link rel="icon" href="http://www.codeproject.com/favicon.ico" type="image/ico">
<link rel="shortcut icon" href="http://www.codeproject.com/favicon.ico" type="image/ico">
<link rel="apple-touch-icon" href="http://www.codeproject.com/images/FavIcon-Apple.png" type="image/png">
<script async="" src="./Programmatically disable enable Windows firewall - CodeProject_files/beacon.js"></script><script type="text/javascript" language="Javascript">//<![CDATA[
if(top!=self && !/https?:\/\/([a-zA-Z]+\.)?facebook.com\//gi.test(top.location.href))top.location.href=location.href; if(typeof(DemoUrl)!='undefined')document.write(unescape('%3Cme')+'ta http'+'-equiv="re'+'fresh" con'+'tent="1;url='+DemoUrl+unescape('"%3CE'));
function SelfCheck(){ return window.confirm("You are about to reply to your own message. Is this really what you want?");}
function FireNew(elm) { window.location=$(elm).find('a')[0].href;}

function MsgVFrm(MemberID,MsgID,GB,gp,bp,mt){
 if(!GB)document.write("Rate this message: ");
 document.write(unescape("%3Ca href=\"#xx" + MsgID.toString() + "xx\" onclick=\"RateMsg(" + MemberID.toString() + ", " + MsgID.toString() + ","));document.write((GB?"5":"1")+unescape(",0);\"%3E"));
 if(GB) document.write(unescape("%3Cimg height=\"20\" width=\"20\" src=\"/script/Forums/Images/good.png\" alt=\"good\" border=\"0\" align=\"absmiddle\" /%3E "+gp+" "+mt+"%3C/a%3E "));
 else document.write(unescape("%3Cimg height=\"14px\" width=\"14px\" src=\"http://s.codeproject.com/script/Forums/Images/thumbs_down.gif\" alt=\"vote 1\" border=\"0\" align=\"middle\" /%3E%3C/a%3E "));
 if(GB)document.write(" &nbsp;"); else for(var i=1; i<=5;i++)
  document.write(unescape("%3Ca class=\"toolbar nav-link\" href=\"#xx" + MsgID.toString() + "xx\" title=\"vote this message a " + i.toString() + "\" onclick=\"RateMsg(" + MemberID.toString() + ", " + MsgID.toString() + ", " + i.toString() + ",0)\"%3E%3Cb%3E" + i.toString() + "%3C/b%3E%3C/a%3E "));
 document.write(unescape("%3Ca href=\"#xx" + MsgID.toString() + "xx\" onclick=\"RateMsg(" + MemberID.toString() + ", " + MsgID.toString() + ","));document.write((GB?"1":"5")+unescape(",0);\"%3E"));
 if(GB)document.write(unescape("%3Cimg height=\"20\" width=\"20\" src=\"/script/Forums/Images/bad.png\" alt=\"bad\" border=\"0\" align=\"absmiddle\" /%3E "+bp+" "+mt+"%3C/a%3E"));
 else document.write(unescape("%3Cimg height=\"14px\" width=\"14px\" src=\"http://s.codeproject.com/script/Forums/Images/thumbs_up.gif\" border=\"0\" alt=\"vote 5\" align=\"middle\" /%3E%3C/a%3E "));
}

function ReportMsg(userid, msgid, score) {
 if (confirm("Are you sure you want this message removed?"))
  return RateMsg(userid, msgid, score, 0);
 else return false;
}
function RateMsg(memberid, msgid, score, questionId) {
 var req = new XMLHttpRequest();
 req.onreadystatechange = function() {
  if (req.readyState == 4){
   if (req.status == 200){
    var respText = req.responseText;
    var re = new RegExp(unescape("\%3Cdiv\%3E(.*)\%3C/div\%3E"), "g");
    var match = re.exec(respText);
    voteStatus.innerHTML = unescape("%3Cb%3E") + (match&&match.length>1&&match[1])?match[1]:"An error occurred" + unescape("%3C/b%3E");
   } else
    voteStatus.innerHTML = unescape("%3Cb style='color:red'%3EFailed!") + req.statusText + unescape("%3C/b%3E");
  }
 }
 var voteStatus = document.getElementById("MVF" + msgid);
 if (!voteStatus) return;
 voteStatus.innerHTML = unescape("%3Cb style='color:green'%3EVoting...%3C/b%3E");
 var strAction = "/script/Forums/Vote.aspx?js=1&fmid="+memberid.toString()+"&select="+msgid.toString()+"&score="+score.toString()+"&qid="+questionId.toString();
 req.open("GET", strAction, true);
 req.send(null);
  return false;
}
var smoothScroll = true;
var Selected = "-1";
var oldTitle = document.title;
function Pin(elm){
 CloseMsg(Selected);
 Selected=''
 var wrk=elm.parentNode; if(wrk)wrk=wrk.children[0];
 var fc=elm?elm.firstChild:null;
 if (wrk&&!wrk.pinned) {
  OpenMsg(wrk.name, true);wrk.pinned=true;fc.src='http://s.codeproject.com/script/forums/images/pinned.gif';fc.title='Pinned. Click to unpin'
 } else {
  wrk.pinned=false;CloseMsg(wrk.name); fc.src='http://s.codeproject.com/script/forums/images/pin.gif';fc.title='Click to pin message'
 }
 return false;
}
function CloseMsg(msgId) {
 if(!msgId||msgId==''||msgId<0)return;
 var lnk=document.getElementsByName(msgId);
 if(lnk&&lnk.length>0&&lnk[0].pinned)return;
 var hed=document.getElementById('F' + msgId.toString() + '_h0');
 if(hed) hed.className = hed.className.replace("Sel", "UnSel");
 var bdy=document.getElementById('F' + msgId.toString() + '_h1');
 if(bdy) bdy.style.display = 'none';
 if(oldTitle) document.title = oldTitle;
}
function OpenMsg(msgId, keep) {
 if(!msgId||msgId==''||msgId<0)return;
 var bdy=document.getElementById('F' + msgId.toString() + '_h1');
 if(bdy){
  var lnk=document.getElementsByName(msgId);
  if(lnk&&lnk.length>0&&lnk[0].pinned)keep=true;
  if(lnk&&lnk.length>0) { oldTitle=document.title; document.title = lnk[0].innerHTML + ' - CodeProject'; }
  if(keep&&bdy.style.display!='none')return;
  if(bdy.style.display=='none') bdy.style.display='';
  else bdy.style.display = 'none';
 }
 var hed=document.getElementById('F' + msgId.toString() + '_h0');
 if (hed) hed.className = hed.className.replace('UnSel', 'Sel');
 if(bdy&&hed&&bdy.style.display!='none'){
  var webkitWeird=document.documentElement.scrollTop < document.body.scrollTop;
  if (!webkitWeird)document.body.scrollTop = getRealPos(hed, 'Top') - document.body.clientHeight/10;
  EnsureMessageVisible(msgId, true);
 }
}
function EnsureMessageVisible(msgID, bShowTop) {
	var webkitWeird = document.documentElement.scrollTop < document.body.scrollTop;
	var msgHeader = document.getElementById('F' + msgID + '_h0');
	var msgBody = document.getElementById('F' + msgID + '_h1');
	if (!msgBody || !msgHeader) return;
	var scrollContainer = document.documentElement;
	var top = getRealPos(msgHeader, 'Top');
	var bottom = getRealPos(msgBody, 'Top') + msgBody.offsetHeight;
	var scrollTop = webkitWeird? scrollTop = document.body.scrollTop:document.documentElement.scrollTop;
	if (scrollTop > top && !bShowTop) scrollTop = top - scrollContainer.clientHeight / 10;
	if (scrollTop + scrollContainer.clientHeight < bottom) scrollTop = bottom - scrollContainer.clientHeight;
	if (scrollTop > top && bShowTop) scrollTop = top - scrollContainer.clientHeight / 10;
 if (smoothScroll){
  if (webkitWeird) $(document.body).stop().animate({'scrollTop' : scrollTop}, 'fast');
  else $(scrollContainer).stop().animate({'scrollTop' : scrollTop}, 'fast');
 } else {
  if (webkitWeird) document.body.scrollTop = scrollTop;
  else scrollContainer.scrollTop = scrollTop;
 }
}
function getRealPos(i,which) {
	iPos = 0;
	while (i!=null)  {
		iPos += i['offset' + which];
		i = i.offsetParent;
	}
	return iPos;
}
var switchCallback;
function SwitchMessage(e, msgId) {
  if (msgId) msgId=msgId.toString();
  else {
    if(!e)e=window.event;
    var target=e.target?e.target:e.srcElement;
    while(target&&target.className!='message-link')target=target.parentNode;
    if(!target||target.className!='message-link')return;
    if(target.pinned){/*Selected='';*/return false;}
    msgId=target.name;
  }
  CloseMsg(Selected)
  if(Selected==msgId) Selected='';
  else { OpenMsg(msgId, false); Selected=msgId;}
  if (e){if(e.preventDefault)e.preventDefault;else e.returnValue=false;}
    if(switchCallback)switchCallback(null, msgId)
  return false;
}


//]]>
</script>

	
<script type="text/javascript">
  var _comscore = _comscore || [];
  _comscore.push({ c1: "2", c2: "13507173" });
  (function() {
	var s = document.createElement("script"), el = document.getElementsByTagName("script")[0]; s.async = true;
	s.src = (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js";
	el.parentNode.insertBefore(s, el);
  })();
</script>
<noscript>
  &lt;img src="http://b.scorecardresearch.com/p?c1=2&amp;c2=13507173&amp;cv=2.0&amp;cj=1" id="ctl00_Auditing_ComScore" /&gt;
</noscript>



<script type="text/javascript">
	var _gaq = _gaq || [];
	_gaq.push(['_setAccount', 'UA-1735123-1']);
	_gaq.push(['_trackPageview']);
	_gaq.push(['_setDomainName', 'www.codeproject.com']);
	_gaq.push(['_setSessionTimeout', '1200']); 

	(function () {
		var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
	})(); 
</script><script type="text/javascript" async="" src="./Programmatically disable enable Windows firewall - CodeProject_files/ga.js"></script>


</head>	

<body class="chrome chrome18">




<a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#Main"><img alt="Click here to Skip to main content" class="access-link" src="./Programmatically disable enable Windows firewall - CodeProject_files/t.gif"></a>


<div class="page-background">
	<div id="A" class="container-content">

		
		<div id="ctl00_Suggest" class="suggestions">
		
<div class="alert-bar " style="">
	<a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#" class="close-notify">×</a>
	<div><b>Not quite what you are looking for? You may want to try:</b><ul class="see-also"><li><a href="http://www.codeproject.com/KB/security/xpsecuritycenter.aspx?q=Windows+Firewall">Software Development: Build your own Windows Security Center</a></li><li><a href="http://www.codeproject.com/KB/vista-security/VistaFirewallNet.aspx?q=Windows+Firewall">The managed classes to read Windows Firewall configuration on Vista using Advanced Security Interfaces</a></li></ul><div id="removeHilite" class="alert-bar-command">
<a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#" onclick="unmarkText(&#39;contentdiv&#39;,&#39;removeHilite&#39;)">highlights off</a>
</div>
</div>
</div>
		</div>

		

		
		

<div class="container nav-memberbar clearfix">
	<div class="member-stats float-left">8,866,705 members and growing! (57,763 online)</div>
	<div class="float-left"></div>

	<div class="float-right">
		&nbsp;&nbsp;
	</div>

	<div class="float-right">
		

<span class="tooltip member-message">
	<img src="./Programmatically disable enable Windows firewall - CodeProject_files/envelope11.gif" width="11px" height="11px" style="vertical-align:bottom;padding-bottom:3px">
	<div class="tooltip-flyout small-text">
		
		<div id="ctl00_MemberMenu_Messages_Confirm"><a id="ctl00_MemberMenu_Messages_EmailConfirm" href="http://www.codeproject.com/script/Membership/SendConfirmRequest.aspx?rp=%2fArticles%2f17309%2fProgrammatically-disable-enable-Windows-firewall">Your email address needs to be confirmed.</a></div>
	</div>
</span><span id="ctl00_MemberMenu_CurRat" class="tooltip">
				<a id="ctl00_MemberMenu_MyProfile" href="http://www.codeproject.com/script/Membership/View.aspx?mid=8126139">quwenchao</a><img src="./Programmatically disable enable Windows firewall - CodeProject_files/arrow-down-16.png" style="width:16px;height:16px;vertical-align:bottom">
				<div class="tooltip-flyout" style="width:110px !important">
					<div><a id="ctl00_MemberMenu_MySettingsNonSSL" href="http://www.codeproject.com/script/Membership/Modify.aspx">My Settings</a></div>
					<div><a id="ctl00_MemberMenu_MySettings" href="https://www.codeproject.com/script/Membership/Modify.aspx"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/secure.png" width="13px" height="14px" style="vertical-align:middle;border:0">My Settings (SSL)</a></div>
					<div><a id="ctl00_MemberMenu_MyContacts" href="http://www.codeproject.com/script/Membership/ListContacts.aspx">My Contact info</a></div>
					<div><a id="ctl00_MemberMenu_MyBookmarks" href="http://www.codeproject.com/script/Bookmarks/List.aspx?obtid=2">My Bookmarks</a></div>
					
					<div><a id="ctl00_MemberMenu_MyCodeProject" href="http://www.codeproject.com/script/Membership/MyWatchedItems.aspx">My Watched Items</a></div>
					<div><a id="ctl00_MemberMenu_MyArticles" href="http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=8126139">My Articles</a></div>
					<div><a id="ctl00_MemberMenu_MyMessages" href="http://www.codeproject.com/script/Forums/Messages.aspx?fmid=8126139">My Messages</a></div>
					<div><a id="ctl00_MemberMenu_MyQuestions" href="http://www.codeproject.com/script/Answers/MemberPosts.aspx?tab=questions&mid=8126139&showall=True">My Questions</a></div>
					<div><a id="ctl00_MemberMenu_MyAnswers" href="http://www.codeproject.com/script/Answers/MemberPosts.aspx?tab=answers&mid=8126139&showall=True">My Answers</a></div>
					<div><a id="ctl00_MemberMenu_MyComments" href="http://www.codeproject.com/script/comments/MemberComments.aspx?mid=8126139">My Comments</a></div>
					
				</div>
			</span><span id="ctl00_MemberMenu_TotalPoints" title="Total reputation points 962" class="member-rep-box silver" style="margin-left:0"><a href="http://www.codeproject.com/script/Reputation/List.aspx?mid=8126139">962</a></span>
			&nbsp;
			<a id="ctl00_MemberMenu_Signout" href="http://www.codeproject.com/script/Membership/LogOff.aspx?rp=%2fArticles%2f17309%2fProgrammatically-disable-enable-Windows-firewall">Sign out</a>

		
	</div>
</div>
		

		
		<table width="100%" cellspacing="0" cellpadding="0" border="0">
		<tbody><tr>
			<td class="page-header"><a href="http://www.codeproject.com/"><img id="ctl00_Logo" title="The Code Project" src="./Programmatically disable enable Windows firewall - CodeProject_files/logo225x90.gif" alt="Home" style="border-width:0px;"></a></td>
			<td class="page-header" align="right">
				<div class="lqm_ad" lqm_publisher="lqm.codeproject.site" lqm_zone="ros" lqm_format="728x90" lqm_tags="VB, Windows, .NET, Visual-Studio, Dev, Intermediate,rating4"><iframe id="lqmad1" width="728" height="90" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe></div>
			</td>
		</tr></tbody></table>

		<table cellpadding="0" cellspacing="0" class="contrast1-background extended"><tbody><tr><td nowrap="nowrap">
			

<div class="navbar clearfix">
<ul id="nav" class="openable">

<li><a id="ctl00_TopNavBar_Home" class="down" href="http://www.codeproject.com/">Home</a>


</li><li><a id="ctl00_TopNavBar_Art" class="down selected" href="http://www.codeproject.com/script/Articles/Latest.aspx">Articles</a>

	<ul class="openable">
		<li><a id="ctl00_TopNavBar_ArtTopicList" class="fly last" onmouseover="navBarMenu.ShowMap(this, &#39;siteMap&#39;);" href="http://www.codeproject.com/script/Content/SiteMap.aspx">Chapters and Sections<span class="fly-menu">&gt;</span></a><ul id="ctl00_TopNavBar_MapFlyout" class="openable"><li>
				<div id="siteMap" class="tooltip-flyout">
					<img src="./Programmatically disable enable Windows firewall - CodeProject_files/animated.gif" style="margin:150px;width:100px;height:100px;">
				</div>
			</li></ul>
		</li>
		<li><a id="ctl00_TopNavBar_ArtSearch" class="fly break" href="http://www.codeproject.com/search.aspx">Search</a></li>
		<li><a id="ctl00_TopNavBar_ArtLatestArts" class="fly" href="http://www.codeproject.com/script/Articles/Latest.aspx?at=1,3,7">Latest Articles</a></li>
		<li><a id="ctl00_TopNavBar_ArtLatestTips" class="fly" href="http://www.codeproject.com/script/Articles/Latest.aspx?at=6">Latest Tips/Tricks</a></li>
		<li><a id="ctl00_TopNavBar_ArtTop" class="fly" href="http://www.codeproject.com/script/Articles/TopArticles.aspx?ta_so=5">Top Articles</a></li>
		<li><a id="ctl00_TopNavBar_ArtBeginner" class="fly" href="http://www.codeproject.com/search.aspx?aidlst=152&sa_us=True">Beginner Articles</a></li>
		<li id="ctl00_TopNavBar_VideosLink">
			<a id="ctl00_TopNavBar_ArtVideoArticles" class="fly" href="http://www.codeproject.com/script/Articles/VideoArticleList.aspx">Video Articles</a>
		</li>
		<li><a id="ctl00_TopNavBar_ArtBlogArticles" class="fly break" href="http://www.codeproject.com/script/Articles/BlogArticleList.aspx">Technical Blogs</a></li>
		<li><a id="ctl00_TopNavBar_ArtPostArticle" class="fly" href="http://www.codeproject.com/script/Articles/Submit.aspx">Submit an Article or Tip</a></li>
		<li><a id="ctl00_TopNavBar_ArtPostBlog" class="fly break" href="http://www.codeproject.com/script/Articles/BlogFeed.aspx">Post your Blog</a></li>
		<li><a id="ctl00_TopNavBar_ArtGuide" class="fly" href="http://www.codeproject.com/info/Submit.aspx">Posting/Update Guidelines</a></li>
		<li><a id="ctl00_TopNavBar_ArtCompetition" class="fly last" href="http://www.codeproject.com/script/Awards/CurrentCompetitions.aspx?cmpTpId=1">Article Competition</a></li>
	</ul>

</li>



<li><a id="ctl00_TopNavBar_Answers" href="http://www.codeproject.com/script/Answers/List.aspx?tab=active">Quick Answers</a>
	<ul class="openable">
		<li id="ctl00_TopNavBar_AQL"><a id="ctl00_TopNavBar_ArticleQuestion" class="fly highlight" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#_comments">Ask a Question about this article</a></li>

		<li><a id="ctl00_TopNavBar_QAAsk" class="fly" href="http://www.codeproject.com/Questions/ask.aspx">Ask a Question</a></li>

		
		<li><a id="ctl00_TopNavBar_QAUnanswered" class="fly" href="http://www.codeproject.com/script/Answers/List.aspx?tab=unanswered">View Unanswered Questions</a></li>
		<li><a id="ctl00_TopNavBar_QALatest" class="fly" href="http://www.codeproject.com/script/Answers/List.aspx?tab=active">View All Questions...</a></li>
		
				<li><a id="ctl00_TopNavBar_QATR_ctl00_Tag" class="fly" href="http://www.codeproject.com/script/Answers/List.aspx?tab=active&alltags=true&tags=81" style="padding-left:30px">C# questions</a></li>
			
				<li><a id="ctl00_TopNavBar_QATR_ctl01_Tag" class="fly" href="http://www.codeproject.com/script/Answers/List.aspx?tab=active&alltags=true&tags=85" style="padding-left:30px">ASP.NET questions</a></li>
			
				<li><a id="ctl00_TopNavBar_QATR_ctl02_Tag" class="fly" href="http://www.codeproject.com/script/Answers/List.aspx?tab=active&alltags=true&tags=842" style="padding-left:30px">VB.NET questions</a></li>
			
				<li><a id="ctl00_TopNavBar_QATR_ctl03_Tag" class="fly" href="http://www.codeproject.com/script/Answers/List.aspx?tab=active&alltags=true&tags=78" style="padding-left:30px">C++ questions</a></li>
			
				<li><a id="ctl00_TopNavBar_QATR_ctl04_Tag" class="fly" href="http://www.codeproject.com/script/Answers/List.aspx?tab=active&alltags=true&tags=308" style="padding-left:30px">C#4.0 questions</a></li>
			
	</ul>

</li>



<li><a id="ctl00_TopNavBar_Forums" href="http://www.codeproject.com/script/Forums/List.aspx">Discussions</a>

	<ul class="openable">
		<li><a id="ctl00_TopNavBar_MessageBoardsAll" class="fly" href="http://www.codeproject.com/script/Forums/List.aspx">All Message Boards...</a></li>
		<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/1580997/Application-Lifecycle.aspx">Application Lifecycle<span class="fly-menu">&gt;</span></a>
<ul class="openable"><li><a class="fly" href="http://www.codeproject.com/Forums/1533717/Running-a-Business.aspx">Running a Business</a></li>
<li><a class="fly" href="http://www.codeproject.com/Forums/1533716/Sales-Marketing.aspx">Sales / Marketing</a></li>
<li><a class="fly" href="http://www.codeproject.com/Forums/1651/Collaboration-Beta-Testing.aspx">Collaboration / Beta Testing</a></li>
<li><a class="fly" href="http://www.codeproject.com/Forums/3304/Work-Training-Issues.aspx">Work &amp; Training Issues</a></li>
</ul></li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/369270/Design-and-Architecture.aspx">Design and Architecture</a>
</li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/12076/ASP-NET.aspx">ASP.NET</a>
</li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/1580226/JavaScript.aspx">JavaScript</a>
</li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/1647/C-Cplusplus-MFC.aspx">C / C++ / MFC<span class="fly-menu">&gt;</span></a>
<ul class="openable"><li><a class="fly" href="http://www.codeproject.com/Forums/4486/ATL-WTL-STL.aspx">ATL /  WTL / STL</a></li>
<li><a class="fly" href="http://www.codeproject.com/Forums/3785/Managed-Cplusplus-CLI.aspx">Managed C++/CLI</a></li>
</ul></li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/1649/Csharp.aspx">C#</a>
</li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/1627782/Free-Tools.aspx">Free Tools</a>
</li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/1725/Database.aspx">Database</a>
</li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/186301/Hardware-Devices.aspx">Hardware &amp; Devices<span class="fly-menu">&gt;</span></a>
<ul class="openable"><li><a class="fly" href="http://www.codeproject.com/Forums/1644/System-Admin.aspx">System Admin</a></li>
</ul></li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/1606152/Hosting-and-Servers.aspx">Hosting and Servers</a>
</li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/1643/Java.aspx">Java</a>
</li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/1650/NET-Framework.aspx">.NET Framework</a>
</li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/13695/Mobile.aspx">Mobile</a>
</li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/1653293/VS-11-NET-4-5.aspx">VS 11 &amp; .NET 4.5</a>
</li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/1540733/Sharepoint.aspx">Sharepoint</a>
</li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/1004257/Silverlight-WPF.aspx">Silverlight / WPF</a>
</li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/1646/Visual-Basic.aspx">Visual Basic</a>
</li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/1640/Web-Development.aspx">Web Development</a>
</li>
<li><a class="fly" style="padding-left:30px" href="http://www.codeproject.com/Forums/1645/Site-Bugs-Suggestions.aspx">Site Bugs / Suggestions</a>
</li>

		<li class="heading">Other Languages<span class="fly-menu">&gt;</span>
		<ul class="openable">
		<li><a class="fly" href="http://www.codeproject.com/Forums/1580229/Hindi.aspx">General Indian Topics</a></li>
		<li><a class="fly" href="http://www.codeproject.com/Forums/1580230/Chinese.aspx">General Chinese Topics</a></li>
		</ul>
		</li>
		
	</ul>

</li>

<li><a id="ctl00_TopNavBar_Zones" href="http://www.codeproject.com/Zones/index.aspx">Zones</a>

	<ul class="openable">
		<!--<li class="heading">Zones</li>-->
		<li><a href="http://www.codeproject.com/Zones/Commerce/" class="fly">The Commerce Zone</a></li><li><a href="http://www.codeproject.com/Zones/Mobile/" class="fly">The Mobile &amp; App Zone</a></li><li><a href="http://www.codeproject.com/Zones/Cloud/" class="fly">The Cloud Zone</a></li><li><a href="http://www.codeproject.com/Zones/Hardware/" class="fly">The Hardware Zone</a></li><li><a href="http://www.codeproject.com/Zones/Parallelism/" class="fly">The Parallelism Zone</a></li><li><a href="http://www.codeproject.com/Zones/WPF-Silverlight/" class="fly">The WPF / Silverlight Zone</a></li><li><a href="http://www.codeproject.com/Zones/Flex-Flash/" class="fly">The Flex / Flash Zone</a></li><li><a href="http://www.codeproject.com/Zones/HTML-CSS/" class="fly">The HTML5 / CSS3 Zone</a></li><li><a href="http://www.codeproject.com/Zones/SharePoint/" class="fly">SharePoint Zone</a></li><li><a href="http://www.codeproject.com/Zones/SqlServer/" class="fly">The SQL Zone</a></li><li><a href="http://www.codeproject.com/Zones/WhitePapers/" class="fly break">WhitePapers / Webcasts</a></li>
		<li><a id="ctl00_TopNavBar_Solutions" class="fly last" href="http://www.codeproject.com/KB/solution-center/">Solutions Center</a></li>
	</ul>

</li>










<li><a id="ctl00_TopNavBar_Features" href="http://www.codeproject.com/Feature/">Features</a>

	<ul class="openable">
		<li><a id="ctl00_TopNavBar_WhosWho" class="fly" href="http://www.codeproject.com/script/Membership/Profiles.aspx">Who's Who</a></li>
		<li><a id="ctl00_TopNavBar_MVPs" class="fly" href="http://www.codeproject.com/script/Awards/MVPWinners.aspx">Most Valuable Professionals</a></li>
		<li><a id="ctl00_TopNavBar_Companies" class="fly break" href="http://www.codeproject.com/script/Membership/Profiles.aspx?mgtid=1&mgm=True">Company Listings</a></li>
		<li><a id="ctl00_TopNavBar_Catalog" class="fly" href="http://www.codeproject.com/script/Catalog/List.aspx">Component &amp; Service Catalog</a></li>
		<li><a id="ctl00_TopNavBar_Comps" class="fly" href="http://www.codeproject.com/script/Awards/CurrentCompetitions.aspx?cmpTpId=1&awsac=true">Competitions</a></li>
		<li><a id="ctl00_TopNavBar_News" class="fly" href="http://www.codeproject.com/script/News/List.aspx">News</a></li>
		<li></li>
		<li><a id="ctl00_TopNavBar_Insider" class="fly" href="http://www.codeproject.com/Feature/Insider/">The Insider Newsletter</a></li>
		<li><a id="ctl00_TopNavBar_Newsletters" class="fly" href="http://www.codeproject.com/script/Mailouts/Archive.aspx?mtpid=1">Newsletter archive</a></li>
		<li><a id="ctl00_TopNavBar_PressRelease" class="fly" href="http://www.codeproject.com/script/PressReleases/Preview.aspx">Press Releases</a></li>
		<li><a id="ctl00_TopNavBar_Surveys" class="fly" href="http://www.codeproject.com/script/Surveys/List.aspx">Surveys</a></li>
		<li><a id="ctl00_TopNavBar_Stuff" class="fly last" href="http://www.codeproject.com/Info/Stuff.aspx">CodeProject Stuff</a></li>
		<li></li>
	</ul>

</li>


<li><a id="ctl00_TopNavBar_Help" href="http://www.codeproject.com/KB/FAQs/">Help!</a>

	<ul class="openable">
		<li><a id="ctl00_TopNavBar_HelpWhatIs" class="fly" href="http://www.codeproject.com/info/guide.aspx">What is 'The Code Project'?</a></li>
		<li><a id="ctl00_TopNavBar_HelpGeneral" class="fly" href="http://www.codeproject.com/KB/FAQs/">General FAQ</a></li>
		<li><a id="ctl00_TopNavBar_HelpPostQuestion" class="fly" href="http://www.codeproject.com/Questions/ask.aspx">Post a Question</a></li>
		<li><a id="ctl00_TopNavBar_HelpBugs" class="fly" href="http://www.codeproject.com/Forums/1645/Site-Bugs-Suggestions.aspx">Bugs and Suggestions</a></li>
		<li><a id="ctl00_TopNavBar_HelpSiteMap" class="fly" href="http://www.codeproject.com/script/Content/SiteMap.aspx">Site Map</a></li>
		<li><a id="ctl00_TopNavBar_HelpAdvertise" class="fly" href="http://lakequincy.com/">Advertise with us</a></li>
		<li><a id="ctl00_TopNavBar_HelpAboutUs" class="fly last" href="http://www.codeproject.com/info/about.aspx">About Us</a></li>
	</ul>

</li>


<li style="margin-left:10px">
<a id="ctl00_TopNavBar_Lounge" class="simple" href="http://www.codeproject.com/Lounge.aspx">The Lounge</a>

	<ul class="openable">
		<li><a id="ctl00_TopNavBar_InsiderLnk" class="fly" href="http://www.codeproject.com/Insider.aspx">The Insider News</a></li>
		<li><a id="ctl00_TopNavBar_LoungeLnk" class="fly" href="http://www.codeproject.com/Lounge.aspx">The Lounge &nbsp;</a></li>
		<li><a id="ctl00_TopNavBar_CleverLnk" class="fly" href="http://www.codeproject.com/Feature/CleverCode.aspx">Clever Code</a></li>
		<li><a id="ctl00_TopNavBar_ShameLnk" class="fly" href="http://www.codeproject.com/Feature/HallOfSHame.aspx">Hall of Shame</a></li>
		<li><a id="ctl00_TopNavBar_SoapBoxLnk" class="fly" href="http://www.codeproject.com/Forums/1536756/The-Soapbox.aspx">The Soapbox</a></li>
	</ul>

</li>

</ul>

</div>

		</td><td align="right">
			

<div class="search-bar">

<form method="get" action="http://www.codeproject.com/search.aspx" name="Search" class="tight">


<table border="0" cellspacing="0" cellpadding="0" class="search"><tbody><tr><td><input tabindex="2" class="search highlight" id="sb_tb" value="Windows Firewall" name="q"></td><td><input type="image" src="./Programmatically disable enable Windows firewall - CodeProject_files/search.gif"></td></tr></tbody></table>

<div class="hover-container">
	<div id="SearchFilter" class="search-advanced small-text align-left" style="display: none; ">
	<b>Search within:<br></b>
		
		<input type="radio" id="sb_kw" name="sbo" value="kw" checked="true"><label for="sb_kw">Articles</label><br>
<input type="radio" id="sb_qa" name="sbo" value="qa"><label for="sb_qa">Quick Answers</label><br>
<input type="radio" id="sb_fm" name="sbo" value="fm"><label for="sb_fm">Messages</label><br>
<input type="radio" id="sb_ctlk" name="sbo" value="ctlk"><label for="sb_ctlk">Product Catalog</label><br>


		
		
	</div>
</div>
</form>

</div>
		</td></tr></tbody></table>
		

		
		<div class="container-article hreview-aggregate"> 
		
			
			<div class="container-header">
				<div id="ctl00_Header" class="header">

					<a name="Main"></a>

					
					<a name="_articleTop" id="_articleTop"></a>
					

<div class="clearfix hover-container">

	
	<div class="float-right action-links"> 
		<span id="SBI"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/share_drop24.png" id="ctl00_TitleArea_ActionLinks_AddTo_Img" width="37" height="24" alt="add" style="vertical-align:middle">
</span>
<div id="ATD" class="list-socialbookmark" style="left: 656px; top: 20px; "><div><a class="AddTo" title="Add this page to Twitter" onclick="return socialLinks.addto(0);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#"><img align="absmiddle" src="./Programmatically disable enable Windows firewall - CodeProject_files/AddTo_Twitter.gif" width="16px" height="16px" border="0"> Twitter</a> </div><div><a class="AddTo" title="Add this page to Digg" onclick="return socialLinks.addto(1);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#"><img align="absmiddle" src="./Programmatically disable enable Windows firewall - CodeProject_files/AddTo_Digg.png" width="16px" height="16px" border="0"> Digg</a> </div><div><a class="AddTo" title="Add this page to Facebook" onclick="return socialLinks.addto(2);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#"><img align="absmiddle" src="./Programmatically disable enable Windows firewall - CodeProject_files/AddTo_Facebook.png" width="16px" height="16px" border="0"> Facebook</a> </div><div><a class="AddTo" title="Add this page to Del.icio.us" onclick="return socialLinks.addto(3);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#"><img align="absmiddle" src="./Programmatically disable enable Windows firewall - CodeProject_files/AddTo_Delicious.png" width="16px" height="16px" border="0"> Del.icio.us</a> </div><div><a class="AddTo" title="Add this page to Reddit" onclick="return socialLinks.addto(4);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#"><img align="absmiddle" src="./Programmatically disable enable Windows firewall - CodeProject_files/AddTo_Reddit.png" width="16px" height="16px" border="0"> Reddit</a> </div><div><a class="AddTo" title="Add this page to Stumbleupon" onclick="return socialLinks.addto(5);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#"><img align="absmiddle" src="./Programmatically disable enable Windows firewall - CodeProject_files/AddTo_stumbleupon.png" width="16px" height="16px" border="0"> Stumbleupon</a> </div><div><a class="AddTo" title="Add this page to Newsvine" onclick="return socialLinks.addto(6);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#"><img align="absmiddle" src="./Programmatically disable enable Windows firewall - CodeProject_files/AddTo_Newsvine.png" width="16px" height="16px" border="0"> Newsvine</a> </div><div><a class="AddTo" title="Add this page to Technorati" onclick="return socialLinks.addto(7);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#"><img align="absmiddle" src="./Programmatically disable enable Windows firewall - CodeProject_files/AddTo_Technorati.png" width="16px" height="16px" border="0"> Technorati</a> </div><div><a class="AddTo" title="Add this page to Mr. Wong" onclick="return socialLinks.addto(8);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#"><img align="absmiddle" src="./Programmatically disable enable Windows firewall - CodeProject_files/AddTo_MrWong.png" width="16px" height="16px" border="0"> Mr. Wong</a> </div><div><a class="AddTo" title="Add this page to Yahoo!" onclick="return socialLinks.addto(9);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#"><img align="absmiddle" src="./Programmatically disable enable Windows firewall - CodeProject_files/AddTo_Yahoo.png" width="16px" height="16px" border="0"> Yahoo!</a> </div><div><a class="AddTo" title="Add this page to Google" onclick="return socialLinks.addto(10);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#"><img align="absmiddle" src="./Programmatically disable enable Windows firewall - CodeProject_files/AddTo_Google.png" width="16px" height="16px" border="0"> Google</a> </div><div><a class="AddTo" title="Add this page to Windows Live" onclick="return socialLinks.addto(11);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#"><img align="absmiddle" src="./Programmatically disable enable Windows firewall - CodeProject_files/AddTo_Live.png" width="16px" height="16px" border="0"> Windows Live</a> </div><div><a class="AddTo" title="Send as Email" onclick="return socialLinks.addto(12);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#"><img align="absmiddle" src="./Programmatically disable enable Windows firewall - CodeProject_files/envelope.gif" width="16px" height="16px" border="0"> Send as Email</a> </div></div> 
 

<span class="tooltip">
	<a id="ctl00_TitleArea_ActionLinks_ArticleBmk_ImgBt" title="Bookmark" alternatetext="Bookmark" name="bm_17309_2" onclick="return bookmarkMe(17309,2,&#39;/script/Bookmarks/Ajax/Add.aspx?obid=17309&amp;obtid=2&amp;action=AddBookmark&amp;bio=true&#39;,true);" href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=17309&obtid=2&action=AddBookmark&bio=true" style="display:inline-block;height:24px;width:24px;vertical-align:middle;"><img title="Bookmark" src="./Programmatically disable enable Windows firewall - CodeProject_files/bookmark.png" alt="" style="border-width:0px;"></a>


<span id="ctl00_TitleArea_ActionLinks_ArticleBmk_StatusMsg" class="tiny-text" style="display:none" name="bm_17309_2"></span>
 
	<div class="speech-bubble-container-up">
		<div class="speech-bubble-up">Add to your CodeProject bookmarks</div>
		<div class="speech-bubble-pointer-up">
			<div class="speech-bubble-pointer-up-inner"></div>
		</div>
	</div>
</span>


<a id="ctl00_TitleArea_ActionLinks_PrintLnk" class="tooltip" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall?display=Print">
	<img src="./Programmatically disable enable Windows firewall - CodeProject_files/print.gif" width="24px" height="24px" style="vertical-align:middle;border:0">
	<div class="speech-bubble-container-up">
		<div class="speech-bubble-up">Print Article</div>
		<div class="speech-bubble-pointer-up">
			<div class="speech-bubble-pointer-up-inner"></div>
		</div>
	</div>
</a>
	</div>

	<div class="container">
		
		<div class="breadcrumb float-left"><a href="http://www.codeproject.com/script/Content/SiteMap.aspx"><span class="sitemap-anchor" onmouseover="navBarMenu.ShowMap(this,&#39;map&#39;);"><img width="16px" height="16px" src="./Programmatically disable enable Windows firewall - CodeProject_files/sitemap16.png" border="0" alt="Site map" style="vertical-align:middle"><div id="map" class="tooltip-flyout"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/animated.gif" style="margin:150px;width:100px;height:100px;border:0;"></div></span></a> » <a href="http://www.codeproject.com/Chapters/6/General-Programming.aspx">General Programming</a> » <a href="http://www.codeproject.com/KB/IP/">Internet / Network</a> » <a href="http://www.codeproject.com/KB/IP/#Proxy+%2f+Firewall">Proxy / Firewall</a></div>
	</div>

	
	<div id="ctl00_TitleArea_InfoArea" class="float-right pad-top">
		

<div class="infobox">
	<table class="tight small-text" cellpadding="0" cellspacing="1">
	<tbody><tr><td>Licence&nbsp;</td><td><a href="http://www.codeproject.com/info/cpol10.aspx" title="The Code Project Open License (CPOL)">CPOL</a></td></tr>
	
	<tr><td>First Posted&nbsp;</td><td nowrap="nowrap"><b>24 Jan 2007</b></td></tr>
	<tr><td>Views&nbsp;</td><td><b>41,772</b></td></tr>
		
	
	<tr><td>Bookmarked&nbsp;</td><td><b>33 times</b></td></tr>
	

	
	
	</tbody></table>
</div>	
	</div>

	
	<div class="item">
	<h1 id="ctl00_TitleArea_ArticleTitle" class="fn">Programmatically disable/enable Windows firewall</h1> 
	</div>

	
	<div class="author">
		By <b><a rel="author" href="http://www.codeproject.com/script/Membership/View.aspx?mid=2597845">petersunde</a></b> | 
		24 Jan 2007 
		
		| <a id="ctl00_TitleArea_ArticleInfoLink" href="http://www.codeproject.com/script/Articles/Types.aspx?#Article">Article</a>

		
		
	</div>
	
	<div class="tags">
	<span id="ctl00_TitleArea_TagsList_TagWrp" class="tags">
	
	
	
	<span id="ctl00_TitleArea_TagsList_VisibleTags"><span class="t"><a rel="tag" href="http://www.codeproject.com/Tags/VB">VB</a></span><span class="t"><a rel="tag" href="http://www.codeproject.com/Tags/Windows">Windows</a></span><span class="t"><a rel="tag" href="http://www.codeproject.com/Tags/.NET">.NET</a></span><span class="t"><a rel="tag" href="http://www.codeproject.com/Tags/Visual-Studio">Visual-Studio</a></span><span class="t"><a rel="tag" href="http://www.codeproject.com/Tags/Dev">Dev</a></span><span class="t"><a rel="tag" href="http://www.codeproject.com/Tags/Intermediate">Intermediate</a></span></span> 

	
	
</span>

	</div>

	
	<div class="abstract summary"><span id="ctl00_TitleArea_ArticleDescr">This article teaches you how to disable and enable your Windows firewall programmatically.</span></div>
</div>



					

				</div>

				<div id="ctl00_HeadSide" class="header-sidebar">
					<div class="align-left" style="height:24px">
						


&nbsp;










					</div>

					

<div class="bold pad-top">See Also</div>
<ul class="outdent small-text" style="margin-left:5px">
	<li><a id="ctl00_SeeAlso_LikeThis" href="http://www.codeproject.com/search.aspx?q=Programmatically+disable%2fenable+Windows+firewall">More like this</a></li>
	<li><a id="ctl00_SeeAlso_ByAuthor" href="http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=2597845">More by this author</a></li>
</ul>

				</div>

			</div>
			

			
			<div id="ctl00_Nav" class="container-nav">
				<div id="ctl00_TabContainer" class="tabs-container clearfix">

					<div class="float-left">
						
						

<div class="tabs float-left"><table cellpadding="0" cellspacing="0"><tbody><tr>
	<td class="tab-selected">Article</td><td class="tab-unselected"><a href="http://www.codeproject.com/script/Articles/ViewDownloads.aspx?aid=17309">Browse Code</a></td><td class="tab-unselected"><a href="http://www.codeproject.com/script/Articles/Statistics.aspx?aid=17309">Stats</a></td><td class="tab-unselected"><a href="http://www.codeproject.com/script/Articles/ListVersions.aspx?aid=17309">Revisions</a></td><td class="tab-unselected"><a href="http://www.codeproject.com/script/Articles/ListAlternatives.aspx?aid=17309">Alternatives</a></td>
</tr></tbody></table></div>	


						
						<div class="float-left" style="margin-left:15px">
							<div id="ctl00_CurRat" class="tooltip anchorLink" style="cursor:pointer" onclick="scrollToAnchor(&#39;#_rating&#39;);" name="CurRat_17309">
								

<table cellpadding="0" cellspacing="0" class="small-text">
<tbody><tr>
	
	<td class="nowrap">

		<span id="ctl00_ArticleRating_VI">
		<div class="nowrap rating-stars" style="height:24px;width:120px;position:relative;">
	<div class="clipped align-left float-left" style="height:24px;width:102px;">
		<img src="./Programmatically disable enable Windows firewall - CodeProject_files/stars-fill.png" style="border-width:0px;">
	</div><div class="clipped" style="height:24px;width:18px;position:relative;">
		<img src="./Programmatically disable enable Windows firewall - CodeProject_files/stars-empty.png" style="border-width:0px;position:absolute;top:0;right:0;">
	</div>
</div>
		</span>

		
	</td>
	
	<td id="ctl00_ArticleRating_VR" class="nowrap">
		&nbsp;
		<span id="ctl00_ArticleRating_VotesR">&nbsp;<span class="rating">4.28</span> (<span class="count">13 votes</span>)</span>
		
	</td>

</tr>

</tbody></table>

								<div id="ctl00_RB" class="speech-bubble-container-up">
									<div class="speech-bubble-up" style="width:150px !important">
										            
<div>
<table class="feature" width="100%" height="50px" title="Voting Distribution. Recent data only" cellpadding="0" cellspacing="0"><tbody><tr><td class="chart-column rating-ignore-vote" title="Outside deviation limits - not included in score."><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(1).gif" width="20pxpx" height="1px" border="0px" alt="" title=""><br><span title="0 votes">1</span></td>
<td class="chart-column rating-ignore-vote" title="Outside deviation limits - not included in score."><img src="./Programmatically disable enable Windows firewall - CodeProject_files/pollcol.gif" width="20pxpx" height="8px" border="0px" alt="1 vote, 8.3%" title="1 vote, 8.3%"><br><span title="1 vote">2</span></td>
<td class="chart-column"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/pollcol.gif" width="20pxpx" height="8px" border="0px" alt="1 vote, 8.3%" title="1 vote, 8.3%"><br><span title="1 vote">3</span></td>
<td class="chart-column"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/pollcol.gif" width="20pxpx" height="33px" border="0px" alt="4 votes, 33.3%" title="4 votes, 33.3%"><br><span title="4 votes">4</span></td>
<td class="chart-column"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/pollcol.gif" width="20pxpx" height="50px" border="0px" alt="6 votes, 50.0%" title="6 votes, 50.0%"><br><span title="6 votes">5</span></td>
</tr></tbody></table><div class="small-text align-center">4.28/5 - 13 votes</div><div class="small-text align-center subdue">1 removed</div><div class="small-text align-center subdue">μ 4.20, σ<sub>a</sub> 1.69 [<a href="http://www.codeproject.com/KB/FAQs/RatingReputationFAQ.aspx#noisefilter">?</a>]</div>
</div>
									</div>
									<div class="speech-bubble-pointer-up">
										<div class="speech-bubble-pointer-up-inner"></div>
									</div>
								</div>
							</div>
						</div>

						<div class="float-left">
							&nbsp; 
							<a id="discussAnch" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#_comments" class="tooltip anchorLink">
							<img src="./Programmatically disable enable Windows firewall - CodeProject_files/discuss.gif" width="24px" height="24px" alt="Discuss" style="vertical-align:middle;border:0">
								<div class="speech-bubble-container-up">
									<div class="speech-bubble-up">Discuss this article</div>
									<div class="speech-bubble-pointer-up">
										<div class="speech-bubble-pointer-up-inner"></div>
									</div>
								</div>
							</a>
							<span id="ctl00_CmtCnt" class="subdue small-text align-middle" style="margin-left:-4px">12</span>

							&nbsp; <span id="ctl00_ReportItem_StatusMsg" class="tiny-text" style="display:none"></span>


<span id="ctl00_ReportItem_CurRpt" class="tooltip">	
		<img id="ctl00_ReportItem_MenuImage" alt="report" src="./Programmatically disable enable Windows firewall - CodeProject_files/report.gif" style="border-width:0px;vertical-align:middle">
		
		<div class="tooltip-flyout" style="width:220px !important" onmouseover="CheckForUndo(this);">
			<div id="ctl00_ReportItem_CommentDiv" class="small-text">
			<b>Comments?</b><br>
				<input name="ctl00$ReportItem$Comments" type="text" id="ctl00_ReportItem_Comments" class="report-comment">
			</div>
			 
			
					<div id="ctl00_ReportItem_ReportingTypeHeaders_ctl00_Header" class="report-header">Report</div>
					
							<div class="report-prompt nowrap">
								
								<a id="ctl00_ReportItem_ReportingTypeHeaders_ctl00_ReportingTypes_ctl00_Link" name="rpt_17309_2_1" onclick="return ReportMe(17309,2,1,&#39;/script/Content/Report.aspx?obtid=2&amp;obid=17309&amp;obstid=1&amp;ovid=1&amp;rid=1&amp;ajax=True&#39;,false,&#39;ctl00_ReportItem_Comments&#39;);" href="http://www.codeproject.com/script/Content/Report.aspx?obtid=2&obid=17309&obstid=1&ovid=1&rid=1">Unclear or Incomplete</a>
							</div>
						 
							<div class="report-prompt nowrap">
								
								<a id="ctl00_ReportItem_ReportingTypeHeaders_ctl00_ReportingTypes_ctl01_Link" name="rpt_17309_2_10" onclick="return ReportMe(17309,2,10,&#39;/script/Content/Report.aspx?obtid=2&amp;obid=17309&amp;obstid=1&amp;ovid=1&amp;rid=10&amp;ajax=True&#39;,false,&#39;ctl00_ReportItem_Comments&#39;);" href="http://www.codeproject.com/script/Content/Report.aspx?obtid=2&obid=17309&obstid=1&ovid=1&rid=10">Extremely poor quality</a>
							</div>
						 
							<div class="report-prompt nowrap">
								
								<a id="ctl00_ReportItem_ReportingTypeHeaders_ctl00_ReportingTypes_ctl02_Link" name="rpt_17309_2_4" onclick="return ReportMe(17309,2,4,&#39;/script/Content/Report.aspx?obtid=2&amp;obid=17309&amp;obstid=1&amp;ovid=1&amp;rid=4&amp;ajax=True&#39;,false,&#39;ctl00_ReportItem_Comments&#39;);" href="http://www.codeproject.com/script/Content/Report.aspx?obtid=2&obid=17309&obstid=1&ovid=1&rid=4">Off-topic</a>
							</div>
						 
							<div class="report-prompt nowrap">
								
								<a id="ctl00_ReportItem_ReportingTypeHeaders_ctl00_ReportingTypes_ctl03_Link" name="rpt_17309_2_5" onclick="return ReportMe(17309,2,5,&#39;/script/Content/Report.aspx?obtid=2&amp;obid=17309&amp;obstid=1&amp;ovid=1&amp;rid=5&amp;ajax=True&#39;,false,&#39;ctl00_ReportItem_Comments&#39;);" href="http://www.codeproject.com/script/Content/Report.aspx?obtid=2&obid=17309&obstid=1&ovid=1&rid=5">Spam/abusive</a>
							</div>
						 
							<div class="report-prompt nowrap">
								
								<a id="ctl00_ReportItem_ReportingTypeHeaders_ctl00_ReportingTypes_ctl04_Link" name="rpt_17309_2_11" onclick="return ReportMe(17309,2,11,&#39;/script/Content/Report.aspx?obtid=2&amp;obid=17309&amp;obstid=1&amp;ovid=1&amp;rid=11&amp;ajax=True&#39;,false,&#39;ctl00_ReportItem_Comments&#39;);" href="http://www.codeproject.com/script/Content/Report.aspx?obtid=2&obid=17309&obstid=1&ovid=1&rid=11">Plagiarized</a>
							</div>
						 
							<div class="report-prompt nowrap">
								
								<a id="ctl00_ReportItem_ReportingTypeHeaders_ctl00_ReportingTypes_ctl05_Link" name="rpt_17309_2_12" onclick="return ReportMe(17309,2,12,&#39;/script/Content/Report.aspx?obtid=2&amp;obid=17309&amp;obstid=1&amp;ovid=1&amp;rid=12&amp;ajax=True&#39;,false,&#39;ctl00_ReportItem_Comments&#39;);" href="http://www.codeproject.com/script/Content/Report.aspx?obtid=2&obid=17309&obstid=1&ovid=1&rid=12">Inaccurate / Misleading</a>
							</div>
						 
			   
					<div id="ctl00_ReportItem_ReportingTypeHeaders_ctl01_Header" class="report-header">Needs help</div>
					
							<div class="report-prompt nowrap">
								
								<a id="ctl00_ReportItem_ReportingTypeHeaders_ctl01_ReportingTypes_ctl00_Link" name="rpt_17309_2_14" onclick="return ReportMe(17309,2,14,&#39;/script/Content/Report.aspx?obtid=2&amp;obid=17309&amp;obstid=1&amp;ovid=1&amp;rid=14&amp;ajax=True&#39;,false,&#39;ctl00_ReportItem_Comments&#39;);" href="http://www.codeproject.com/script/Content/Report.aspx?obtid=2&obid=17309&obstid=1&ovid=1&rid=14">Format / layout issues</a>
							</div>
						 
							<div class="report-prompt nowrap">
								
								<a id="ctl00_ReportItem_ReportingTypeHeaders_ctl01_ReportingTypes_ctl01_Link" name="rpt_17309_2_15" onclick="return ReportMe(17309,2,15,&#39;/script/Content/Report.aspx?obtid=2&amp;obid=17309&amp;obstid=1&amp;ovid=1&amp;rid=15&amp;ajax=True&#39;,false,&#39;ctl00_ReportItem_Comments&#39;);" href="http://www.codeproject.com/script/Content/Report.aspx?obtid=2&obid=17309&obstid=1&ovid=1&rid=15">Wrong section / tags</a>
							</div>
						 
							<div class="report-prompt nowrap">
								
								<a id="ctl00_ReportItem_ReportingTypeHeaders_ctl01_ReportingTypes_ctl02_Link" name="rpt_17309_2_16" onclick="return ReportMe(17309,2,16,&#39;/script/Content/Report.aspx?obtid=2&amp;obid=17309&amp;obstid=1&amp;ovid=1&amp;rid=16&amp;ajax=True&#39;,false,&#39;ctl00_ReportItem_Comments&#39;);" href="http://www.codeproject.com/script/Content/Report.aspx?obtid=2&obid=17309&obstid=1&ovid=1&rid=16">Wrong type (tip, blog, article)</a>
							</div>
						 
							<div class="report-prompt nowrap">
								
								<a id="ctl00_ReportItem_ReportingTypeHeaders_ctl01_ReportingTypes_ctl03_Link" name="rpt_17309_2_17" onclick="return ReportMe(17309,2,17,&#39;/script/Content/Report.aspx?obtid=2&amp;obid=17309&amp;obstid=1&amp;ovid=1&amp;rid=17&amp;ajax=True&#39;,false,&#39;ctl00_ReportItem_Comments&#39;);" href="http://www.codeproject.com/script/Content/Report.aspx?obtid=2&obid=17309&obstid=1&ovid=1&rid=17">Missing images/downloads</a>
							</div>
						 
							<div class="report-prompt nowrap">
								
								<a id="ctl00_ReportItem_ReportingTypeHeaders_ctl01_ReportingTypes_ctl04_Link" name="rpt_17309_2_18" onclick="return ReportMe(17309,2,18,&#39;/script/Content/Report.aspx?obtid=2&amp;obid=17309&amp;obstid=1&amp;ovid=1&amp;rid=18&amp;ajax=True&#39;,false,&#39;ctl00_ReportItem_Comments&#39;);" href="http://www.codeproject.com/script/Content/Report.aspx?obtid=2&obid=17309&obstid=1&ovid=1&rid=18">Images/downloads are offsite</a>
							</div>
						 
			   

			<div class="Undo"></div>
		</div>
	</span>



							   
						</div>

					</div>

				</div>

				
			</div>
			

			
			<div class="container-text">

				<div id="AT" class="text">
					
					
					
					

						
							
			
					<div id="ctl00_confirmError" class="callout small-text" style="padding:10px;margin:20px;"><img style="float:left;margin-right:10px" src="./Programmatically disable enable Windows firewall - CodeProject_files/warning_32.png" width="32px" height="32px"><b>Is your email address OK?</b>
					You are signed up for our newsletters but your email address is either unconfirmed, or has not 
					been reconfirmed in a long time. Please click 
					<a id="ctl00_RequestConfirmLink2" href="http://www.codeproject.com/script/Membership/SendConfirmRequest.aspx?rp=%2fArticles%2f17309%2fProgrammatically-disable-enable-Windows-firewall">here</a> to have a 
					confirmation email sent so we can confirm your email address and start sending you newsletters 
					again. Alternatively, you can 
					<a id="ctl00_SubscribeLink2" href="http://www.codeproject.com/script/Membership/Subscribe.aspx?rp=%2fArticles%2f17309%2fProgrammatically-disable-enable-Windows-firewall">update your subscriptions</a>.</div><form name="aspnetForm" method="post" action="./Programmatically disable enable Windows firewall - CodeProject_files/Programmatically disable enable Windows firewall - CodeProject.htm" id="aspnetForm" style="margin:0;padding:0"><div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMjExOTQzNjk4Mw9kFgJmD2QWAgIHD2QWCgIBDxYCHgdWaXNpYmxlZ2QCEQ9kFgICAQ9kFgZmDw8WAh4LTmF2aWdhdGVVcmwFMi9zY3JpcHQvQXJ0aWNsZXMvQWRtaW4vRWRpdG9yQ2hvaWNlLmFzcHg/YWlkPTE3MzA5ZGQCAg8PFgIfAQU4L3NjcmlwdC9Bd2FyZHMvQWRtaW4vQXdhcmRPYmplY3QuYXNweD9vYmlkPTE3MzA5Jm9idGlkPTJkZAIKDw8WAh8BBS8vc2NyaXB0L0FydGljbGVzL0FkbWluL1F1ZXVlRWRpdC5hc3B4P2FpZD0xNzMwOWRkAhMPZBYCAgEPZBYCAgIPFgIeCWlubmVyaHRtbAUCMTJkAhUPZBYCAgsPZBYIAgEPFgIfAGcWBAIBDw8WAh8BBXQvc2NyaXB0L01lbWJlcnNoaXAvU2VuZENvbmZpcm1SZXF1ZXN0LmFzcHg/cnA9JTJmQXJ0aWNsZXMlMmYxNzMwOSUyZlByb2dyYW1tYXRpY2FsbHktZGlzYWJsZS1lbmFibGUtV2luZG93cy1maXJld2FsbGRkAgMPDxYCHwEFay9zY3JpcHQvTWVtYmVyc2hpcC9TdWJzY3JpYmUuYXNweD9ycD0lMmZBcnRpY2xlcyUyZjE3MzA5JTJmUHJvZ3JhbW1hdGljYWxseS1kaXNhYmxlLWVuYWJsZS1XaW5kb3dzLWZpcmV3YWxsZGQCAg8WAh4GYWN0aW9uBUAvQXJ0aWNsZXMvMTczMDkvUHJvZ3JhbW1hdGljYWxseS1kaXNhYmxlLWVuYWJsZS1XaW5kb3dzLWZpcmV3YWxsFgoCAQ8PFgQfAQU2L3NjcmlwdC9BcnRpY2xlcy9TdWJtaXNzaW9uV2l6YXJkLmFzcHg/YXQ9MSZhcGlkPTE3MzA5HwBnZGQCAw9kFgICAQ8WAh8AaGQCBQ9kFgICAg9kFgICAQ8QZGQWAGQCCw8WAh4LXyFJdGVtQ291bnQCAWQCDQ9kFgICAQ8WAh4EVGV4dAV5PGEgY2xhc3M9ImFuY2hvckxpbmsiIGhyZWY9Ii9BcnRpY2xlcy8xNzMwOS9Qcm9ncmFtbWF0aWNhbGx5LWRpc2FibGUtZW5hYmxlLVdpbmRvd3MtZmlyZXdhbGwjX2FydGljbGVUb3AiPkFydGljbGUgVG9wPC9hPmQCCg8PFgQfBQUJUGVybWFsaW5rHwEFQC9BcnRpY2xlcy8xNzMwOS9Qcm9ncmFtbWF0aWNhbGx5LWRpc2FibGUtZW5hYmxlLVdpbmRvd3MtZmlyZXdhbGxkZAIZDxYCHwUFHENvcHlyaWdodCAyMDA3IGJ5IHBldGVyc3VuZGVkAhcPZBYCAgUPDxYCHwBoZGRkZiVlUUTuSfUbSzdGh0F+OX6mBf0=">
</div>

<div>

	<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWCQLh69zXBgKi6fqQCgLAlMXDBwLBlMXDBwLClMXDBwLDlMXDBwLElMXDBwLP+++tCwK5upDkC0YlWWhxlp5qDlubL/aFFlaN6QOG">
</div>

						<a id="ctl00_AddAlternative" title="Write a related article about upgrades or translate this into a different language." class="button add-alternative float-right" href="http://www.codeproject.com/script/Articles/SubmissionWizard.aspx?at=1&apid=17309">Add your own<br>alternative version</a>

						<!-- Article Text Start -->
						<div id="contentdiv">
						




<h2>Introduction</h2>

<p>This article teaches you how to disable and enable your <span class="search-highlight">Windows</span> <span class="search-highlight">firewall</span> programmatically.</p>

<h2>Setup</h2>

<ul>
<li>Create a new <span class="search-highlight">Windows</span> Application project.</li>

<li>Click on Project-&gt;Add Reference and add the following files:</li>

<ul>
<li>Click Browse tab -&gt; Add <em>C:\<span class="search-highlight">windows</span>\system32\Hnetcfg.dll</em>.</li>

<li>Click COM tab -&gt; Add NetFwTypeLib.</li>
</ul>
</ul>

<h2>Requirements</h2>

<p>Currently, this only works with <span class="search-highlight">Windows</span> XP SP2. If you need support for this in Vista, add <em>Wfapi.dll</em>.</p>

<h2>Source</h2>

<div class="pre-action-link" id="premain0" width="100%" style="display:block"><img id="preimg0" src="./Programmatically disable enable Windows firewall - CodeProject_files/minus.gif" style="cursor: pointer; " height="9" width="9" preid="0"><span id="precollapse0" style="cursor: pointer; margin-bottom: 0px; " preid="0"> Collapse</span><span> | </span><a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#" preid="0">Copy Code</a></div><pre lang="vbnet" id="pre0" style="margin-top: 0px; "><span class="code-keyword">Imports</span> System
<span class="code-keyword">Imports</span> NetFwTypeLib

<span class="code-comment">'</span><span class="code-comment"> Provides access to the <span class="search-highlight">firewall</span> settings for a computer.
</span><span class="code-keyword">Public</span> <span class="code-keyword">Function</span> GetFwMgr() <span class="code-keyword">As</span> NetFwTypeLib.INetFwMgr
    <span class="code-keyword">Dim</span> oINetFwMgr <span class="code-keyword">As</span> NetFwTypeLib.INetFwMgr
    <span class="code-keyword">Dim</span> NetFwMgrObject <span class="code-keyword">As</span> <span class="code-keyword">Object</span>
    <span class="code-keyword">Dim</span> NetFwMgrType <span class="code-keyword">As</span> Type

    <span class="code-comment">'</span><span class="code-comment"> Use the COM CLSID to get the associated .NET System.Type
</span>    NetFwMgrType = Type.GetTypeFromCLSID( _
     <span class="code-keyword">New</span> Guid(<span class="code-string">"</span><span class="code-string">{304CE942-6E39-40D8-943A-B913C40C9CD4}"</span>))

    <span class="code-comment">'</span><span class="code-comment"> Create an instance of the object
</span>    NetFwMgrObject = Activator.CreateInstance(NetFwMgrType)
    oINetFwMgr = NetFwMgrObject

    <span class="code-keyword">Return</span> oINetFwMgr
<span class="code-keyword">End</span> <span class="code-keyword">Function</span>


<span class="code-comment">'</span><span class="code-comment"> Provides access to the <span class="search-highlight">firewall</span> settings profile.
</span><span class="code-keyword">Public</span> <span class="code-keyword">Function</span> GetProfile() <span class="code-keyword">As</span> NetFwTypeLib.INetFwProfile

    <span class="code-keyword">Dim</span> oINetPolicy <span class="code-keyword">As</span> NetFwTypeLib.INetFwPolicy
    <span class="code-keyword">Dim</span> oINetFwMgr <span class="code-keyword">As</span> NetFwTypeLib.INetFwMgr

    oINetFwMgr = GetFwMgr()

    oINetPolicy = oINetFwMgr.LocalPolicy
    <span class="code-keyword">Return</span> oINetPolicy.CurrentProfile

<span class="code-keyword">End</span> <span class="code-keyword">Function</span>

<span class="code-comment">'</span><span class="code-comment"> Enable <span class="search-highlight">windows</span> <span class="search-highlight">firewall</span>.
</span><span class="code-keyword">Public</span> <span class="code-keyword">Sub</span> Activate<span class="search-highlight">Firewall</span>()
    <span class="code-keyword">Dim</span> fwProfile <span class="code-keyword">As</span> NetFwTypeLib.INetFwProfile
    fwProfile = GetProfile()
    fwProfile.<span class="search-highlight">Firewall</span>Enabled = <span class="code-keyword">True</span>
<span class="code-keyword">End</span> <span class="code-keyword">Sub</span>

<span class="code-comment">'</span><span class="code-comment"> Disable <span class="search-highlight">windows</span> <span class="search-highlight">firewall</span>.
</span><span class="code-keyword">Public</span> <span class="code-keyword">Sub</span> Disable<span class="search-highlight">Firewall</span>()
    <span class="code-keyword">Dim</span> fwProfile <span class="code-keyword">As</span> NetFwTypeLib.INetFwProfile
    fwProfile = GetProfile()
    fwProfile.<span class="search-highlight">Firewall</span>Enabled = <span class="code-keyword">False</span>
<span class="code-keyword">End</span> <span class="code-keyword">Sub</span>

<span class="code-comment">'</span><span class="code-comment"> <span class="search-highlight">Firewall</span> state || False = Disabled - True = Enabled.
</span><span class="code-keyword">Public</span> <span class="code-keyword">Function</span> <span class="search-highlight">Firewall</span>Enabled() <span class="code-keyword">As</span> <span class="code-keyword">Boolean</span>
    <span class="code-keyword">Dim</span> fwProfile <span class="code-keyword">As</span> NetFwTypeLib.INetFwProfile
    fwProfile = GetProfile()
    <span class="code-keyword">Return</span> fwProfile.<span class="search-highlight">Firewall</span>Enabled
<span class="code-keyword">End</span> <span class="code-keyword">Function</span>

<span class="code-comment">'</span><span class="code-comment"> Enable <span class="search-highlight">firewall</span> on Form_Load.
</span><span class="code-keyword">Private</span> <span class="code-keyword">Sub</span> Form1_Load(<span class="code-keyword">ByVal</span> sender <span class="code-keyword">As</span> System.<span class="code-keyword">Object</span>, _
            <span class="code-keyword">ByVal</span> e <span class="code-keyword">As</span> System.EventArgs) <span class="code-keyword">Handles</span> <span class="code-keyword">MyBase</span>.Load
    <span class="code-keyword">If</span> <span class="search-highlight">Firewall</span>Enabled() = <span class="code-keyword">False</span> <span class="code-keyword">Then</span>
        Activate<span class="search-highlight">Firewall</span>()
    <span class="code-keyword">Else</span>
        Disable<span class="search-highlight">Firewall</span>()
    <span class="code-keyword">End</span> <span class="code-keyword">If</span>
    MessageBox.Show(<span class="code-string">"</span><span class="code-string"><span class="search-highlight">Firewall</span> enabled: "</span> &amp; <span class="search-highlight">Firewall</span>Enabled())
<span class="code-keyword">End</span> <span class="code-keyword">Sub</span></pre>




						</div>
						<!-- Article Text End -->

						
						
						<h2>License</h2>
						<div id="LicenseTerms"><p>This article, along with any associated source code and files, is licensed under <a href="http://www.codeproject.com/info/cpol10.aspx" rel="license">The Code Project Open License (CPOL)</a></p></div>
						

						
						<h2 id="ctl00_AboutHeading">About the Author</h2>

						<div class="float-right">
						<div class="lqm_ad" lqm_publisher="lqm.codeproject.site" lqm_zone="ros" lqm_format="300x250" lqm_loadonview="true" lqm_tags="VB, Windows, .NET, Visual-Studio, Dev, Intermediate,rating4"></div>
						</div>

						
						
<table cellpadding="0" cellspacing="5" border="0">
<tbody><tr valign="top">
<td id="ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberPhotoTable" valign="top" style="width:155px;">
	<b><a id="ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberProfileLink" href="http://www.codeproject.com/Members/petersunde">petersunde</a></b><br><br>
	<center></center>

	<div class="small-text">
		<span id="ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberJobTitle"></span><br>
		<span id="ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberCompany"></span><br>
		<span id="ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberLocation"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/NO.gif" alt="Norway" width="16px" height="11px"> Norway</span><br>
		<br>
		<span id="ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberType">Member</span><br>
		
		<br>

		
	</div>
</td>

<td>
	<br>	
</td>
</tr>
</tbody></table><br>
						
						

						<div class="clearfix"></div>

						
						<div id="ctl00_RateArticleRow" class="clearfix voting-bar">
						<div class="float-left" style="padding-top:8px"><a class="anchorLink" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#_articleTop">Article Top</a></div>
						<div class="float-right"><a id="_rating" name="_rating">&nbsp;</a></div> 
						<div class="float-right align-right">
							<div id="ctl00_RateArticle_RateItemWrapper" class="small-text" name="RateItem_17309">

	<table width="100%" cellpadding="0" cellspacing="0" class="small-text">
	<tbody><tr>
		<td id="ctl00_RateArticle_VoteResultDiv" nowrap="nowrap" align="right">
			<span class="voteRes"></span>
			<img class="loaderImg" width="16px" alt="loading..." height="16px" src="./Programmatically disable enable Windows firewall - CodeProject_files/animated_loading_blue.gif" style="display:none;"> 
		</td>

	
		<td class="voteTbl" style="white-space:nowrap" align="right">
			<table class="small-text">
			<tbody><tr>
				
				<td id="ctl00_RateArticle_RateText" class="rating-prompt">
					Rate this:
				</td>

				<td id="ctl00_RateArticle_StartForm" align="right" nowrap="nowrap">
					<i>&nbsp;&nbsp;Poor</i>
				</td>

				<td id="ctl00_RateArticle_VoteFormDiv" class="nowrap">
					

					<span id="ctl00_RateArticle_RB" class="tooltip ajaxHist radio voting">
						<span id="ctl00_RateArticle_VoteRBL"><input id="ctl00_RateArticle_VoteRBL_0" type="radio" name="ctl00$RateArticle$VoteRBL" value="1" onclick="ChkRtctl00_RateArticle(1, 17309);
$(&#39;#ctl00_RateArticle_RCD&#39;).show();
;"><input id="ctl00_RateArticle_VoteRBL_1" type="radio" name="ctl00$RateArticle$VoteRBL" value="2" onclick="ChkRtctl00_RateArticle(2, 17309);
$(&#39;#ctl00_RateArticle_RCD&#39;).show();
;"><input id="ctl00_RateArticle_VoteRBL_2" type="radio" name="ctl00$RateArticle$VoteRBL" value="3" onclick="ChkRtctl00_RateArticle(3, 17309);
$(&#39;#ctl00_RateArticle_RCD&#39;).show();
;"><input id="ctl00_RateArticle_VoteRBL_3" type="radio" name="ctl00$RateArticle$VoteRBL" value="4" onclick="ChkRtctl00_RateArticle(4, 17309);
$(&#39;#ctl00_RateArticle_RCD&#39;).show();
;"><input id="ctl00_RateArticle_VoteRBL_4" type="radio" name="ctl00$RateArticle$VoteRBL" value="5" onclick="ChkRtctl00_RateArticle(5, 17309);
$(&#39;#ctl00_RateArticle_RCD&#39;).show();
;"></span> 

						
					</span>

				</td>

				<td id="ctl00_RateArticle_EndForm" align="left">
					<i>Excellent</i>
				</td>

				<td>	
					<input type="submit" name="ctl00$RateArticle$SubmitRateBtn" value="Vote" onclick="return PostBack_ctl00_RateArticle_RateItemWrapper();" id="ctl00_RateArticle_SubmitRateBtn" class="button">
				</td>
			</tr>
			</tbody></table>
			<span id="ctl00_RateArticle_ErrorMessage" class="error"></span>
		</td>
	</tr>
	</tbody></table>
	<div class="hover-container">
		<div id="ctl00_RateArticle_RCD" class="rating-comment align-left float-right">
			Add a reason or comment to your vote: <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#" id="clear-rate_ctl00_RateArticle_RCD" title="close">x</a><br>
			<textarea class="RateComment" rows="5" cols="60" style="width:98%;"></textarea>
			<span id="ctl00_RateArticle_CommentReq" class="subdue">Votes of 3 or less require a comment</span>
		</div>
	</div>
</div>
						</div>
						</div>
						

					</form>

					
					<div style="margin:auto;width:728px;height:90px;margin-top:10px">		  
						<div class="lqm_ad" lqm_publisher="lqm.codeproject.site" lqm_zone="bottom" lqm_format="728x90" lqm_loadonview="true" lqm_tags="VB, Windows, .NET, Visual-Studio, Dev, Intermediate,pos_bottom"></div>
					</div>
					

					
					
					<h2>Comments and Discussions</h2>
					<a name="_comments" id="_comments">&nbsp;</a><div id="_MessageBoardctl00_MessageBoard" onclick="return SwitchMessage(event, null)">
	<table id="ForumTable" class="box forum" cellpadding="0" cellspacing="0">
		<tbody><tr>
			<td><table width="100%" border="0" cellpadding="3px" cellspacing="0">
				<tbody><tr class="forum-header1">
					<td colspan="2" style="white-space:nowrap;"><div class="container">
						<div class="button-newmsg float-left" onclick="FireNew(this)">
							<img src="./Programmatically disable enable Windows firewall - CodeProject_files/forum_newmsg.gif" alt="new" width="16px" height="16px" border="0" align="top"> <a href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall" name="Frm_HoverNL" title="Add a Add a Comment or Question" target="_top"><b>Add a Comment or Question</b></a>
						</div>&nbsp;<div class="float-right">
							<form action="http://www.codeproject.com/Search.aspx?fid=0" method="get" class="tight">
								<input type="hidden" name="fid" value="379068"><b>Search this forum </b><input type="text" class="Frm_Input" name="qf" style="width:200px;">&nbsp;<input type="submit" value="Go" class="button">
							</form>
						</div>
					</div></td></tr><tr class="forum-header2">
						<td style="white-space:nowrap;">&nbsp;<a href="http://www.codeproject.com/KB/FAQs/MessageBoardsFAQ.aspx"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_question.gif" title="FAQ" alt="FAQ" style="border-width:0;width:16px;height:16px;vertical-align:middle;"></a></td><td style="width:100%;"><div style="text-align:right;">
							<form action="http://www.codeproject.com/script/Forums/SetOptions.aspx?floc=%2fArticles%2f17309%2fProgrammatically-disable-enable-Windows-firewall&fid=379068" method="get" style="margin:0;padding:0;">
								<input type="hidden" name="fid" value="379068"><input type="hidden" name="currentQS" value="?floc=%2fArticles%2f17309%2fProgrammatically-disable-enable-Windows-firewall&amp;fid=379068"><input type="hidden" name="floc" value="/Articles/17309/Programmatically-disable-enable-Windows-firewall"><input type="checkbox" name="prof" id="prof" style="vertical-align:middle;"><label for="prof">Profile popups</label>&nbsp;&nbsp;&nbsp;&nbsp;Noise<select size="1" class="Frm_DropDown" name="noise">
									<option value="1">Very High</option><option value="2">High</option><option selected="" value="3">Medium</option><option value="4">Low</option><option value="5">Very Low</option>
								</select>&nbsp;&nbsp;Layout<select size="1" class="Frm_DropDown" name="view">
									<option selected="" value="Quick">Normal</option><option value="Topic">Expand Posts only</option><option value="Expanded">Expand Posts &amp; Replies</option><option value="Thread">Thread View</option><option value="Normal">No Javascript</option><option value="Preview">No JS + Preview</option>
								</select>&nbsp;&nbsp;Per page<select size="1" class="Frm_DropDown" name="mpp">
									<option value="10">10</option><option selected="" value="25">25</option><option value="50">50</option>
								</select>&nbsp;&nbsp;&nbsp;<input type="submit" value="Update" name="SetOpt" class="button">
							</form>
						</div></td>
					</tr>
				
			</tbody></table></td></tr><tr>
				<td><a name="xx0xx"></a><table border="0" cellpadding="2px" cellspacing="0" width="100%">
					<tbody><tr class="forum-navbar">
						<td>&nbsp;</td><td style="text-align:right;width:50%;"> <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall?fid=379068">Refresh</a></td><td class="nav-link" style="text-align:right;white-space:nowrap;"><span class="subdue">First</span> <span class="subdue">Prev</span> <span class="subdue">Next</span></td>
					</tr>
				</tbody></table></td>
			</tr><tr>
				<td><table border="0" cellpadding="0" cellspacing="0" width="100%" class="fixed-layout blank-background">
					<tbody><tr>
						<td><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" border="0" width="1px" height="5px" alt=""></td>
					</tr><tr class="MsgHd Rt HdUnSel " id="F3792842_h0">
						<td width="100%"><table class="quickHd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr class="hover-row">
								<td width="16px" class="Frm_MsgIndent"><a name="xx3792842xx"></a><img height="16px" width="16px" align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_question(1).gif" alt="Question"></td><td class="Frm_MsgSubject hover-container"><a class="message-link" name="3792842" parent="0" thread="3792842" href="http://www.codeproject.com/Messages/3792842/firewall-settings.aspx">firewall settings</a> <a onclick="return Pin(this);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#" title="Click to pin message"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/pin.gif" border="0" align="top" alt="Pin" width="13px" height="12px"></a></td><td class="Frm_MsgIcon"><img border="0" src="./Programmatically disable enable Windows firewall - CodeProject_files/icn-member-16.gif" title="member" alt="member" height="16px"></td><td class="Frm_MsgAuthor"><a href="http://www.codeproject.com/script/Membership/View.aspx?mid=7718835">Kanimozhikannanthasan</a></td><td class="Frm_MsgDate" style="vertical-align:top;white-space:nowrap;">5:59 2 Mar '11 &nbsp;</td>
							</tr>
						</tbody></table></td>
					</tr><tr id="F3792842_h1" style="display:none;">
						<td width="100%"><table class="quickBd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr>
								<td class="Frm_MsgIndent" style="width:16px;"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" height="1px" width="16px" alt=""></td><td class="MsgBd BdSel "><table border="0" cellpadding="0" cellspacing="5px" width="100%">
									<tbody><tr>
										<td><table border="0" cellpadding="0" cellspacing="0" width="100%">
											<tbody><tr>
												<td colspan="2">why the NetfwTypelib namespace show error in the program<br></td>
											</tr><tr style="vertical-align:middle;">
												<td class="msg-footer"><a class="button-newmsg" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=3792842&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=r" title="Reply">Reply</a>·<a class="toolbar" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=3792842&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=e" title="Email">Email</a>·<a class="toolbar" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall?fid=379068&tid=3792842" title="View Thread">View&nbsp;Thread</a>·<a class="toolbar" href="http://www.codeproject.com/Messages/3792842/firewall-settings.aspx" title="Get permanent link">Permalink</a>·<a class="toolbar" href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=3792842&obtid=3&action=AddBookmark&bio=false" title="Bookmark this post" onclick="return bookmarkMe(0,0,&#39;/script/Bookmarks/Ajax/Add.aspx?obid=3792842&amp;obtid=3&amp;action=AddBookmark&amp;bio=false&#39;,false, this, this);">Bookmark</a></td><td class="msg-footer" style="text-align:right;"><span id="MVF3792842" style="white-space:nowrap;"><script type="text/javascript">
													MsgVFrm(7718835,3792842,false,"","","");
												</script>Rate this message: <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3792842xx" onclick="RateMsg(7718835, 3792842,1,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_down.gif" alt="vote 1" border="0" align="middle"></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3792842xx" title="vote this message a 1" onclick="RateMsg(7718835, 3792842, 1,0)"><b>1</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3792842xx" title="vote this message a 2" onclick="RateMsg(7718835, 3792842, 2,0)"><b>2</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3792842xx" title="vote this message a 3" onclick="RateMsg(7718835, 3792842, 3,0)"><b>3</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3792842xx" title="vote this message a 4" onclick="RateMsg(7718835, 3792842, 4,0)"><b>4</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3792842xx" title="vote this message a 5" onclick="RateMsg(7718835, 3792842, 5,0)"><b>5</b></a> <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3792842xx" onclick="RateMsg(7718835, 3792842,5,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_up.gif" border="0" alt="vote 5" align="middle"></a> </span></td>
											</tr>
										</tbody></table></td>
									</tr>
								</tbody></table></td>
							</tr>
						</tbody></table></td>
					</tr><tr class="quick">
						<td class="root msg-divide"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" border="0" width="1px" height="1px" alt=""></td>
					</tr><tr class="MsgHd Rt HdUnSel " id="F3694945_h0">
						<td width="100%"><table class="quickHd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr class="hover-row">
								<td width="16px" class="Frm_MsgIndent"><a name="xx3694945xx"></a><img height="16px" width="16px" align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_general.gif" alt="General"></td><td class="Frm_MsgSubject hover-container"><a class="message-link" name="3694945" parent="0" thread="3694945" href="http://www.codeproject.com/Messages/3694945/My-vote-of-5.aspx">My vote of 5</a> <a onclick="return Pin(this);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#" title="Click to pin message"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/pin.gif" border="0" align="top" alt="Pin" width="13px" height="12px"></a></td><td class="Frm_MsgIcon"><img border="0" src="./Programmatically disable enable Windows firewall - CodeProject_files/icn-member-16.gif" title="member" alt="member" height="16px"></td><td class="Frm_MsgAuthor"><a href="http://www.codeproject.com/script/Membership/View.aspx?mid=4314698">theMadCoder</a></td><td class="Frm_MsgDate" style="vertical-align:top;white-space:nowrap;">13:17 10 Dec '10 &nbsp;</td>
							</tr>
						</tbody></table></td>
					</tr><tr id="F3694945_h1" style="display:none;">
						<td width="100%"><table class="quickBd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr>
								<td class="Frm_MsgIndent" style="width:16px;"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" height="1px" width="16px" alt=""></td><td class="MsgBd BdSel "><table border="0" cellpadding="0" cellspacing="5px" width="100%">
									<tbody><tr>
										<td><table border="0" cellpadding="0" cellspacing="0" width="100%">
											<tbody><tr>
												<td colspan="2">provided great example<br></td>
											</tr><tr style="vertical-align:middle;">
												<td class="msg-footer"><a class="button-newmsg" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=3694945&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=r" title="Reply">Reply</a>·<a class="toolbar" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall?fid=379068&tid=3694945" title="View Thread">View&nbsp;Thread</a>·<a class="toolbar" href="http://www.codeproject.com/Messages/3694945/My-vote-of-5.aspx" title="Get permanent link">Permalink</a>·<a class="toolbar" href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=3694945&obtid=3&action=AddBookmark&bio=false" title="Bookmark this post" onclick="return bookmarkMe(0,0,&#39;/script/Bookmarks/Ajax/Add.aspx?obid=3694945&amp;obtid=3&amp;action=AddBookmark&amp;bio=false&#39;,false, this, this);">Bookmark</a></td><td class="msg-footer" style="text-align:right;"><span id="MVF3694945" style="white-space:nowrap;"><script type="text/javascript">
													MsgVFrm(4314698,3694945,false,"","","");
												</script>Rate this message: <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3694945xx" onclick="RateMsg(4314698, 3694945,1,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_down.gif" alt="vote 1" border="0" align="middle"></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3694945xx" title="vote this message a 1" onclick="RateMsg(4314698, 3694945, 1,0)"><b>1</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3694945xx" title="vote this message a 2" onclick="RateMsg(4314698, 3694945, 2,0)"><b>2</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3694945xx" title="vote this message a 3" onclick="RateMsg(4314698, 3694945, 3,0)"><b>3</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3694945xx" title="vote this message a 4" onclick="RateMsg(4314698, 3694945, 4,0)"><b>4</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3694945xx" title="vote this message a 5" onclick="RateMsg(4314698, 3694945, 5,0)"><b>5</b></a> <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3694945xx" onclick="RateMsg(4314698, 3694945,5,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_up.gif" border="0" alt="vote 5" align="middle"></a> </span></td>
											</tr>
										</tbody></table></td>
									</tr>
								</tbody></table></td>
							</tr>
						</tbody></table></td>
					</tr><tr class="quick">
						<td class="root msg-divide"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" border="0" width="1px" height="1px" alt=""></td>
					</tr><tr class="MsgHd Rt HdUnSel " id="F3694661_h0">
						<td width="100%"><table class="quickHd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr class="hover-row">
								<td width="16px" class="Frm_MsgIndent"><a name="xx3694661xx"></a><img height="16px" width="16px" align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_news.gif" alt="News"></td><td class="Frm_MsgSubject hover-container"><a class="message-link" name="3694661" parent="0" thread="3694661" href="http://www.codeproject.com/Messages/3694661/Here-it-is-in-Csharp.aspx">Here it is in C#</a> <a onclick="return Pin(this);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#" title="Click to pin message"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/pin.gif" border="0" align="top" alt="Pin" width="13px" height="12px"></a></td><td class="Frm_MsgIcon"><img border="0" src="./Programmatically disable enable Windows firewall - CodeProject_files/icn-member-16.gif" title="member" alt="member" height="16px"></td><td class="Frm_MsgAuthor"><a href="http://www.codeproject.com/script/Membership/View.aspx?mid=4314698">theMadCoder</a></td><td class="Frm_MsgDate" style="vertical-align:top;white-space:nowrap;">9:25 10 Dec '10 &nbsp;</td>
							</tr>
						</tbody></table></td>
					</tr><tr id="F3694661_h1" style="display:none;">
						<td width="100%"><table class="quickBd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr>
								<td class="Frm_MsgIndent" style="width:16px;"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" height="1px" width="16px" alt=""></td><td class="MsgBd BdSel "><table border="0" cellpadding="0" cellspacing="5px" width="100%">
									<tbody><tr>
										<td><table border="0" cellpadding="0" cellspacing="0" width="100%">
											<tbody><tr>
												<td colspan="2">using System;<br>
using System.Collections.Generic;<br>
using System.Text;<br>
using NetFwTypeLib;<br>
&nbsp;<br>
namespace Firewall_Library<br>
{<br>
    public class FireWall<br>
    {<br>
        private static Type _NetFwMgrType;<br>
        private static Type NetFwMgrType<br>
        {<br>
            get<br>
            {<br>
                if (_NetFwMgrType == null)<br>
                {<br>
                    _NetFwMgrType = Type.GetTypeFromProgID("HNetCfg.FwMgr", false);<br>
                }<br>
                return _NetFwMgrType;<br>
            }<br>
        }<br>
&nbsp;<br>
        private static INetFwMgr _Mgr;<br>
        private static INetFwMgr Mgr<br>
        {<br>
            get<br>
            {<br>
                if (_Mgr == null)<br>
                {<br>
                    _Mgr = Activator.CreateInstance(NetFwMgrType) as INetFwMgr;<br>
                }<br>
                return _Mgr;<br>
            }<br>
        }<br>
&nbsp;<br>
        /// &lt;summary&gt;<br>
        /// Enabled flag of the Firewall<br>
        /// &lt;/summary&gt;<br>
        public static bool Enabled<br>
        {<br>
            get<br>
            {<br>
                bool Firewallenabled = Mgr.LocalPolicy.CurrentProfile.FirewallEnabled;<br>
                return Firewallenabled;<br>
            }<br>
            set<br>
            {<br>
                Mgr.LocalPolicy.CurrentProfile.FirewallEnabled = value;<br>
            }<br>
        }<br>
&nbsp;<br>
        /// &lt;summary&gt;<br>
        /// Create interface for port<br>
        /// &lt;/summary&gt;<br>
        /// &lt;returns&gt;&lt;/returns&gt;<br>
        public static INetFwOpenPort CreateINetFwOpenPort()<br>
        {<br>
            Type TportClass = Type.GetTypeFromProgID("HNetCfg.FWOpenPort");<br>
            INetFwOpenPort port = Activator.CreateInstance(TportClass) as INetFwOpenPort;<br>
            return port;<br>
        }<br>
&nbsp;<br>
<br>
        public static INetFwAuthorizedApplication CreateINetFwAuthorizedApplication()<br>
        {<br>
            Type TApplicationClass = Type.GetTypeFromProgID("HNetCfg.FwAuthorizedApplication");<br>
            INetFwAuthorizedApplication app = Activator.CreateInstance(TApplicationClass) as INetFwAuthorizedApplication;<br>
            return app;<br>
        }<br>
&nbsp;<br>
        /// &lt;summary&gt;<br>
        /// Obtain list of Authorized Ports<br>
        /// &lt;/summary&gt;<br>
        public static INetFwOpenPorts AuthorizedPorts<br>
        {<br>
            get { return Mgr.LocalPolicy.CurrentProfile.GloballyOpenPorts; }<br>
        }<br>
&nbsp;<br>
        /// &lt;summary&gt;<br>
        /// Obtain List of Authorized Applications<br>
        /// &lt;/summary&gt;<br>
        public static INetFwAuthorizedApplications AuthorizedApplications<br>
        {<br>
            get { return Mgr.LocalPolicy.CurrentProfile.AuthorizedApplications; }<br>
        }<br>
    }<br>
}<br>
&nbsp;<br>
<br>
&nbsp;<br>
<br>
to use this<br>
Listing ports<br>
            INetFwOpenPorts ports = FireWall.AuthorizedPorts;<br>
            System.Collections.IEnumerator enumerate;<br>
            if (ports != null)<br>
            {<br>
                enumerate = ports.GetEnumerator();<br>
                if (enumerate != null)<br>
                {<br>
                    Console.WriteLine("Authorized Ports");<br>
                    while (enumerate.MoveNext())<br>
                    {<br>
                        INetFwOpenPort port = enumerate.Current as INetFwOpenPort;<br>
                        if (port != null)<br>
                        {<br>
                            Console.Write("   ");<br>
                            Console.WriteLine(string.Format("{0} ", port.Port));<br>
                        }<br>
                    }<br>
                }<br>
            }<br>
&nbsp;<br>
listing apps<br>
            INetFwAuthorizedApplications applications = FireWall.AuthorizedApplications;<br>
            if (applications != null)<br>
            {<br>
                System.Collections.IEnumerator enumerate;<br>
                enumerate = applications.GetEnumerator();<br>
                Console.WriteLine("Authorized Applications");<br>
                while (enumerate.MoveNext())<br>
                {<br>
                    INetFwAuthorizedApplication app = enumerate.Current as INetFwAuthorizedApplication;<br>
                    if (app != null)<br>
                    {<br>
                        Console.Write("   ");<br>
                        Console.WriteLine(string.Format("{0} ", app.Name));<br>
                    }<br>
                }<br>
            }<br>
&nbsp;<br>
adding a port<br>
&nbsp;<br>
                    INetFwOpenPort _PortToTest = FireWall.CreateINetFwOpenPort();<br>
                    if (_PortToTest != null)<br>
                    {<br>
                        _PortToTest.Port = 7657;<br>
                        _PortToTest.Protocol = NET_FW_IP_PROTOCOL_.NET_FW_IP_PROTOCOL_TCP;<br>
                        _PortToTest.Scope = NET_FW_SCOPE_.NET_FW_SCOPE_ALL;<br>
                        _PortToTest.Name = "Test";<br>
&nbsp;<br>
                         INetFwOpenPorts ports = MOAEC_FireWall.AuthorizedPorts;<br>
                         if (ports != null)<br>
                         {<br>
                            ports.Add(_PortToTest);<br>
                         }<br>
                    }<br>
&nbsp;<br>
<br>
&nbsp;<br>
                  adding an application<br>
                    INetFwAuthorizedApplication _ApplicationToTest = MOAEC_FireWall.CreateINetFwAuthorizedApplication();<br>
                    if (_ApplicationToTest != null)<br>
                    {<br>
&nbsp;<br>
                        Process p = Process.GetCurrentProcess();<br>
                        _ApplicationToTest.ProcessImageFileName = p.MainModule.FileVersionInfo.FileName;<br>
                        _ApplicationToTest.Name = p.ProcessName;<br>
&nbsp;<br>
                        INetFwAuthorizedApplications applications = MOAEC_FireWall.AuthorizedApplications;<br>
                        if (applications != null)<br>
                        {<br>
                          applications.Add(_ApplicationToTest);<br>
                        }<br>
                    }<br></td>
											</tr><tr style="vertical-align:middle;">
												<td class="msg-footer"><a class="button-newmsg" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=3694661&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=r" title="Reply">Reply</a>·<a class="toolbar" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=3694661&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=e" title="Email">Email</a>·<a class="toolbar" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall?fid=379068&tid=3694661" title="View Thread">View&nbsp;Thread</a>·<a class="toolbar" href="http://www.codeproject.com/Messages/3694661/Here-it-is-in-Csharp.aspx" title="Get permanent link">Permalink</a>·<a class="toolbar" href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=3694661&obtid=3&action=AddBookmark&bio=false" title="Bookmark this post" onclick="return bookmarkMe(0,0,&#39;/script/Bookmarks/Ajax/Add.aspx?obid=3694661&amp;obtid=3&amp;action=AddBookmark&amp;bio=false&#39;,false, this, this);">Bookmark</a></td><td class="msg-footer" style="text-align:right;"><span id="MVF3694661" style="white-space:nowrap;"><script type="text/javascript">
													MsgVFrm(4314698,3694661,false,"","","");
												</script>Rate this message: <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3694661xx" onclick="RateMsg(4314698, 3694661,1,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_down.gif" alt="vote 1" border="0" align="middle"></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3694661xx" title="vote this message a 1" onclick="RateMsg(4314698, 3694661, 1,0)"><b>1</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3694661xx" title="vote this message a 2" onclick="RateMsg(4314698, 3694661, 2,0)"><b>2</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3694661xx" title="vote this message a 3" onclick="RateMsg(4314698, 3694661, 3,0)"><b>3</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3694661xx" title="vote this message a 4" onclick="RateMsg(4314698, 3694661, 4,0)"><b>4</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3694661xx" title="vote this message a 5" onclick="RateMsg(4314698, 3694661, 5,0)"><b>5</b></a> <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3694661xx" onclick="RateMsg(4314698, 3694661,5,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_up.gif" border="0" alt="vote 5" align="middle"></a> </span></td>
											</tr>
										</tbody></table></td>
									</tr>
								</tbody></table></td>
							</tr>
						</tbody></table></td>
					</tr><tr class="quick">
						<td class="root msg-divide"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" border="0" width="1px" height="1px" alt=""></td>
					</tr><tr class="MsgHd LoVote Rt HdUnSel " id="F3255530_h0">
						<td width="100%"><table class="quickHd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr class="hover-row">
								<td width="16px" class="Frm_MsgIndent"><a name="xx3255530xx"></a><img height="16px" width="16px" align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_general.gif" alt="General"></td><td class="Frm_MsgSubject hover-container"><a class="message-link" name="3255530" parent="0" thread="3255530" href="http://www.codeproject.com/Messages/3255530/firewall-setting.aspx">firewall setting</a> <a onclick="return Pin(this);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#" title="Click to pin message"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/pin.gif" border="0" align="top" alt="Pin" width="13px" height="12px"></a></td><td class="Frm_MsgIcon"><img border="0" src="./Programmatically disable enable Windows firewall - CodeProject_files/icn-member-16.gif" title="member" alt="member" height="16px"></td><td class="Frm_MsgAuthor"><a href="http://www.codeproject.com/script/Membership/View.aspx?mid=5137613">prakash_adysoft</a></td><td class="Frm_MsgDate" style="vertical-align:top;white-space:nowrap;">4:55 31 Oct '09 &nbsp;</td>
							</tr>
						</tbody></table></td>
					</tr><tr id="F3255530_h1" style="display:none;">
						<td width="100%"><table class="quickBd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr>
								<td class="Frm_MsgIndent" style="width:16px;"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" height="1px" width="16px" alt=""></td><td class="MsgBd BdSel "><table border="0" cellpadding="0" cellspacing="5px" width="100%">
									<tbody><tr>
										<td><table border="0" cellpadding="0" cellspacing="0" width="100%">
											<tbody><tr>
												<td colspan="2">i use following code for firewall setting chanage to enabled. this code run in window XP but i face problem in windows vista<br>
&nbsp;<br>
        Dim fwProfile As NetFwTypeLib.INetFwProfile<br>
        fwProfile = GetProfile()<br>
        Dim regKey As RegistryKey<br>
        regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Winecin", True)<br>
        regKey.SetValue("Firewall", fwProfile.FirewallEnabled)<br>
        regKey.SetValue("FirewallException", fwProfile.ExceptionsNotAllowed)<br>
        regKey.Close()<br>
        fwProfile.FirewallEnabled = True<br>
        fwProfile.ExceptionsNotAllowed = True<br></td>
											</tr><tr style="vertical-align:middle;">
												<td class="msg-footer"><a class="button-newmsg" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=3255530&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=r" title="Reply">Reply</a>·<a class="toolbar" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=3255530&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=e" title="Email">Email</a>·<a class="toolbar" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall?fid=379068&tid=3255530" title="View Thread">View&nbsp;Thread</a>·<a class="toolbar" href="http://www.codeproject.com/Messages/3255530/firewall-setting.aspx" title="Get permanent link">Permalink</a>·<a class="toolbar" href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=3255530&obtid=3&action=AddBookmark&bio=false" title="Bookmark this post" onclick="return bookmarkMe(0,0,&#39;/script/Bookmarks/Ajax/Add.aspx?obid=3255530&amp;obtid=3&amp;action=AddBookmark&amp;bio=false&#39;,false, this, this);">Bookmark</a></td><td class="msg-footer" style="text-align:right;"><span id="MVF3255530" style="white-space:nowrap;">2.00/5 (1 vote) <script type="text/javascript">
													MsgVFrm(5137613,3255530,false,"","","");
												</script>Rate this message: <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3255530xx" onclick="RateMsg(5137613, 3255530,1,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_down.gif" alt="vote 1" border="0" align="middle"></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3255530xx" title="vote this message a 1" onclick="RateMsg(5137613, 3255530, 1,0)"><b>1</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3255530xx" title="vote this message a 2" onclick="RateMsg(5137613, 3255530, 2,0)"><b>2</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3255530xx" title="vote this message a 3" onclick="RateMsg(5137613, 3255530, 3,0)"><b>3</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3255530xx" title="vote this message a 4" onclick="RateMsg(5137613, 3255530, 4,0)"><b>4</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3255530xx" title="vote this message a 5" onclick="RateMsg(5137613, 3255530, 5,0)"><b>5</b></a> <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3255530xx" onclick="RateMsg(5137613, 3255530,5,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_up.gif" border="0" alt="vote 5" align="middle"></a> </span></td>
											</tr>
										</tbody></table></td>
									</tr>
								</tbody></table></td>
							</tr>
						</tbody></table></td>
					</tr><tr class="quick">
						<td class="root msg-divide"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" border="0" width="1px" height="1px" alt=""></td>
					</tr><tr class="MsgHd Rt HdUnSel " id="F3248041_h0">
						<td width="100%"><table class="quickHd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr class="hover-row">
								<td width="16px" class="Frm_MsgIndent"><a name="xx3248041xx"></a><img height="16px" width="16px" align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_general.gif" alt="General"></td><td class="Frm_MsgSubject hover-container"><a class="message-link" name="3248041" parent="0" thread="3248041" href="http://www.codeproject.com/Messages/3248041/good-article.aspx">good article</a> <a onclick="return Pin(this);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#" title="Click to pin message"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/pin.gif" border="0" align="top" alt="Pin" width="13px" height="12px"></a></td><td class="Frm_MsgIcon"><img border="0" src="./Programmatically disable enable Windows firewall - CodeProject_files/icn-member-16.gif" title="member" alt="member" height="16px"></td><td class="Frm_MsgAuthor"><a href="http://www.codeproject.com/script/Membership/View.aspx?mid=483675">Donsw</a></td><td class="Frm_MsgDate" style="vertical-align:top;white-space:nowrap;">21:12 25 Oct '09 &nbsp;</td>
							</tr>
						</tbody></table></td>
					</tr><tr id="F3248041_h1" style="display:none;">
						<td width="100%"><table class="quickBd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr>
								<td class="Frm_MsgIndent" style="width:16px;"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" height="1px" width="16px" alt=""></td><td class="MsgBd BdSel "><table border="0" cellpadding="0" cellspacing="5px" width="100%">
									<tbody><tr>
										<td><table border="0" cellpadding="0" cellspacing="0" width="100%">
											<tbody><tr>
												<td colspan="2">Good article but this only shows xp which is the easiest. how about an update for vista and now win 7 <br>
&nbsp;<br>
<div class="ForumSig">cheers,<br>
Donsw<br>
My Recent Article : CDC - Change Data Capture</div><br></td>
											</tr><tr style="vertical-align:middle;">
												<td class="msg-footer"><a class="button-newmsg" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=3248041&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=r" title="Reply">Reply</a>·<a class="toolbar" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=3248041&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=e" title="Email">Email</a>·<a class="toolbar" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall?fid=379068&tid=3248041" title="View Thread">View&nbsp;Thread</a>·<a class="toolbar" href="http://www.codeproject.com/Messages/3248041/good-article.aspx" title="Get permanent link">Permalink</a>·<a class="toolbar" href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=3248041&obtid=3&action=AddBookmark&bio=false" title="Bookmark this post" onclick="return bookmarkMe(0,0,&#39;/script/Bookmarks/Ajax/Add.aspx?obid=3248041&amp;obtid=3&amp;action=AddBookmark&amp;bio=false&#39;,false, this, this);">Bookmark</a></td><td class="msg-footer" style="text-align:right;"><span id="MVF3248041" style="white-space:nowrap;"><script type="text/javascript">
													MsgVFrm(483675,3248041,false,"","","");
												</script>Rate this message: <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3248041xx" onclick="RateMsg(483675, 3248041,1,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_down.gif" alt="vote 1" border="0" align="middle"></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3248041xx" title="vote this message a 1" onclick="RateMsg(483675, 3248041, 1,0)"><b>1</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3248041xx" title="vote this message a 2" onclick="RateMsg(483675, 3248041, 2,0)"><b>2</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3248041xx" title="vote this message a 3" onclick="RateMsg(483675, 3248041, 3,0)"><b>3</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3248041xx" title="vote this message a 4" onclick="RateMsg(483675, 3248041, 4,0)"><b>4</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3248041xx" title="vote this message a 5" onclick="RateMsg(483675, 3248041, 5,0)"><b>5</b></a> <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx3248041xx" onclick="RateMsg(483675, 3248041,5,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_up.gif" border="0" alt="vote 5" align="middle"></a> </span></td>
											</tr>
										</tbody></table></td>
									</tr>
								</tbody></table></td>
							</tr>
						</tbody></table></td>
					</tr><tr class="quick">
						<td class="root msg-divide"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" border="0" width="1px" height="1px" alt=""></td>
					</tr><tr class="MsgHd Rt HdUnSel " id="F2884746_h0">
						<td width="100%"><table class="quickHd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr class="hover-row">
								<td width="16px" class="Frm_MsgIndent"><a name="xx2884746xx"></a><img height="16px" width="16px" align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_general.gif" alt="General"></td><td class="Frm_MsgSubject hover-container"><a class="message-link" name="2884746" parent="0" thread="2884746" href="http://www.codeproject.com/Messages/2884746/Theres-other-Forms-of-disabling-Windows-Firewall.aspx">There's other Forms of disabling Windows Firewall</a> <a onclick="return Pin(this);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#" title="Click to pin message"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/pin.gif" border="0" align="top" alt="Pin" width="13px" height="12px"></a></td><td class="Frm_MsgIcon"><img border="0" src="./Programmatically disable enable Windows firewall - CodeProject_files/icn-member-16.gif" title="member" alt="member" height="16px"></td><td class="Frm_MsgAuthor"><a href="http://www.codeproject.com/script/Membership/View.aspx?mid=5753441">Rot1</a></td><td class="Frm_MsgDate" style="vertical-align:top;white-space:nowrap;">12:17 17 Jan '09 &nbsp;</td>
							</tr>
						</tbody></table></td>
					</tr><tr id="F2884746_h1" style="display:none;">
						<td width="100%"><table class="quickBd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr>
								<td class="Frm_MsgIndent" style="width:16px;"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" height="1px" width="16px" alt=""></td><td class="MsgBd BdSel "><table border="0" cellpadding="0" cellspacing="5px" width="100%">
									<tbody><tr>
										<td><table border="0" cellpadding="0" cellspacing="0" width="100%">
											<tbody><tr>
												<td colspan="2">By disabling / enabling the service using WinSvc.h header file and some APIs such as ControlService, look it up on MSDN and follow up the tree.<br>
&nbsp;<br>
The way showned above is more easier to perform and more efficiently, it uses COM objects.<br></td>
											</tr><tr style="vertical-align:middle;">
												<td class="msg-footer"><a class="button-newmsg" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=2884746&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=r" title="Reply">Reply</a>·<a class="toolbar" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=2884746&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=e" title="Email">Email</a>·<a class="toolbar" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall?fid=379068&tid=2884746" title="View Thread">View&nbsp;Thread</a>·<a class="toolbar" href="http://www.codeproject.com/Messages/2884746/Theres-other-Forms-of-disabling-Windows-Firewall.aspx" title="Get permanent link">Permalink</a>·<a class="toolbar" href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=2884746&obtid=3&action=AddBookmark&bio=false" title="Bookmark this post" onclick="return bookmarkMe(0,0,&#39;/script/Bookmarks/Ajax/Add.aspx?obid=2884746&amp;obtid=3&amp;action=AddBookmark&amp;bio=false&#39;,false, this, this);">Bookmark</a></td><td class="msg-footer" style="text-align:right;"><span id="MVF2884746" style="white-space:nowrap;"><script type="text/javascript">
													MsgVFrm(5753441,2884746,false,"","","");
												</script>Rate this message: <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2884746xx" onclick="RateMsg(5753441, 2884746,1,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_down.gif" alt="vote 1" border="0" align="middle"></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2884746xx" title="vote this message a 1" onclick="RateMsg(5753441, 2884746, 1,0)"><b>1</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2884746xx" title="vote this message a 2" onclick="RateMsg(5753441, 2884746, 2,0)"><b>2</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2884746xx" title="vote this message a 3" onclick="RateMsg(5753441, 2884746, 3,0)"><b>3</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2884746xx" title="vote this message a 4" onclick="RateMsg(5753441, 2884746, 4,0)"><b>4</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2884746xx" title="vote this message a 5" onclick="RateMsg(5753441, 2884746, 5,0)"><b>5</b></a> <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2884746xx" onclick="RateMsg(5753441, 2884746,5,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_up.gif" border="0" alt="vote 5" align="middle"></a> </span></td>
											</tr>
										</tbody></table></td>
									</tr>
								</tbody></table></td>
							</tr>
						</tbody></table></td>
					</tr><tr class="quick">
						<td class="root msg-divide"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" border="0" width="1px" height="1px" alt=""></td>
					</tr><tr class="MsgHd LoVote Rt HdUnSel " id="F2805095_h0">
						<td width="100%"><table class="quickHd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr class="hover-row">
								<td width="16px" class="Frm_MsgIndent"><a name="xx2805095xx"></a><img height="16px" width="16px" align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_general.gif" alt="General"></td><td class="Frm_MsgSubject hover-container"><a class="message-link" name="2805095" parent="0" thread="2805095" href="http://www.codeproject.com/Messages/2805095/Enable-Disable-Widows-Firewall-for-Remote-System.aspx">Enable Disable Widows Firewall for Remote System.</a> <a onclick="return Pin(this);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#" title="Click to pin message"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/pin.gif" border="0" align="top" alt="Pin" width="13px" height="12px"></a></td><td class="Frm_MsgIcon"><img border="0" src="./Programmatically disable enable Windows firewall - CodeProject_files/icn-member-16.gif" title="member" alt="member" height="16px"></td><td class="Frm_MsgAuthor"><a href="http://www.codeproject.com/script/Membership/View.aspx?mid=5690408">ganesh19840515</a></td><td class="Frm_MsgDate" style="vertical-align:top;white-space:nowrap;">5:09 13 Nov '08 &nbsp;</td>
							</tr>
						</tbody></table></td>
					</tr><tr id="F2805095_h1" style="display:none;">
						<td width="100%"><table class="quickBd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr>
								<td class="Frm_MsgIndent" style="width:16px;"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" height="1px" width="16px" alt=""></td><td class="MsgBd BdSel "><table border="0" cellpadding="0" cellspacing="5px" width="100%">
									<tbody><tr>
										<td><table border="0" cellpadding="0" cellspacing="0" width="100%">
											<tbody><tr>
												<td colspan="2">Anybody have idea that how to disable Windows Firewall of Remote system using same Code.<br></td>
											</tr><tr style="vertical-align:middle;">
												<td class="msg-footer"><a class="button-newmsg" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=2805095&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=r" title="Reply">Reply</a>·<a class="toolbar" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=2805095&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=e" title="Email">Email</a>·<a class="toolbar" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall?fid=379068&tid=2805095" title="View Thread">View&nbsp;Thread</a>·<a class="toolbar" href="http://www.codeproject.com/Messages/2805095/Enable-Disable-Widows-Firewall-for-Remote-System.aspx" title="Get permanent link">Permalink</a>·<a class="toolbar" href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=2805095&obtid=3&action=AddBookmark&bio=false" title="Bookmark this post" onclick="return bookmarkMe(0,0,&#39;/script/Bookmarks/Ajax/Add.aspx?obid=2805095&amp;obtid=3&amp;action=AddBookmark&amp;bio=false&#39;,false, this, this);">Bookmark</a></td><td class="msg-footer" style="text-align:right;"><span id="MVF2805095" style="white-space:nowrap;">2.33/5 (3 votes) <script type="text/javascript">
													MsgVFrm(5690408,2805095,false,"","","");
												</script>Rate this message: <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2805095xx" onclick="RateMsg(5690408, 2805095,1,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_down.gif" alt="vote 1" border="0" align="middle"></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2805095xx" title="vote this message a 1" onclick="RateMsg(5690408, 2805095, 1,0)"><b>1</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2805095xx" title="vote this message a 2" onclick="RateMsg(5690408, 2805095, 2,0)"><b>2</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2805095xx" title="vote this message a 3" onclick="RateMsg(5690408, 2805095, 3,0)"><b>3</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2805095xx" title="vote this message a 4" onclick="RateMsg(5690408, 2805095, 4,0)"><b>4</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2805095xx" title="vote this message a 5" onclick="RateMsg(5690408, 2805095, 5,0)"><b>5</b></a> <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2805095xx" onclick="RateMsg(5690408, 2805095,5,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_up.gif" border="0" alt="vote 5" align="middle"></a> </span></td>
											</tr>
										</tbody></table></td>
									</tr>
								</tbody></table></td>
							</tr>
						</tbody></table></td>
					</tr><tr class="quick">
						<td class="root msg-divide"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" border="0" width="1px" height="1px" alt=""></td>
					</tr><tr class="MsgHd Rt HdUnSel " id="F2727206_h0">
						<td width="100%"><table class="quickHd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr class="hover-row">
								<td width="16px" class="Frm_MsgIndent"><a name="xx2727206xx"></a><img height="16px" width="16px" align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_general.gif" alt="General"></td><td class="Frm_MsgSubject hover-container"><a class="message-link" name="2727206" parent="0" thread="2727206" href="http://www.codeproject.com/Messages/2727206/error-in-code.aspx">error in code</a> <a onclick="return Pin(this);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#" title="Click to pin message"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/pin.gif" border="0" align="top" alt="Pin" width="13px" height="12px"></a></td><td class="Frm_MsgIcon"><img border="0" src="./Programmatically disable enable Windows firewall - CodeProject_files/icn-member-16.gif" title="member" alt="member" height="16px"></td><td class="Frm_MsgAuthor"><a href="http://www.codeproject.com/script/Membership/View.aspx?mid=5522935">oudfliurquidqw058fh</a></td><td class="Frm_MsgDate" style="vertical-align:top;white-space:nowrap;">4:34 17 Sep '08 &nbsp;</td>
							</tr>
						</tbody></table></td>
					</tr><tr id="F2727206_h1" style="display:none;">
						<td width="100%"><table class="quickBd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr>
								<td class="Frm_MsgIndent" style="width:16px;"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" height="1px" width="16px" alt=""></td><td class="MsgBd BdSel "><table border="0" cellpadding="0" cellspacing="5px" width="100%">
									<tbody><tr>
										<td><table border="0" cellpadding="0" cellspacing="0" width="100%">
											<tbody><tr>
												<td colspan="2">I am getting error in all function statements that this statement is not valid.please help me.<br></td>
											</tr><tr style="vertical-align:middle;">
												<td class="msg-footer"><a class="button-newmsg" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=2727206&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=r" title="Reply">Reply</a>·<a class="toolbar" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=2727206&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=e" title="Email">Email</a>·<a class="toolbar" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall?fid=379068&tid=2727206" title="View Thread">View&nbsp;Thread</a>·<a class="toolbar" href="http://www.codeproject.com/Messages/2727206/error-in-code.aspx" title="Get permanent link">Permalink</a>·<a class="toolbar" href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=2727206&obtid=3&action=AddBookmark&bio=false" title="Bookmark this post" onclick="return bookmarkMe(0,0,&#39;/script/Bookmarks/Ajax/Add.aspx?obid=2727206&amp;obtid=3&amp;action=AddBookmark&amp;bio=false&#39;,false, this, this);">Bookmark</a></td><td class="msg-footer" style="text-align:right;"><span id="MVF2727206" style="white-space:nowrap;"><script type="text/javascript">
													MsgVFrm(5522935,2727206,false,"","","");
												</script>Rate this message: <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2727206xx" onclick="RateMsg(5522935, 2727206,1,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_down.gif" alt="vote 1" border="0" align="middle"></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2727206xx" title="vote this message a 1" onclick="RateMsg(5522935, 2727206, 1,0)"><b>1</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2727206xx" title="vote this message a 2" onclick="RateMsg(5522935, 2727206, 2,0)"><b>2</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2727206xx" title="vote this message a 3" onclick="RateMsg(5522935, 2727206, 3,0)"><b>3</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2727206xx" title="vote this message a 4" onclick="RateMsg(5522935, 2727206, 4,0)"><b>4</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2727206xx" title="vote this message a 5" onclick="RateMsg(5522935, 2727206, 5,0)"><b>5</b></a> <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2727206xx" onclick="RateMsg(5522935, 2727206,5,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_up.gif" border="0" alt="vote 5" align="middle"></a> </span></td>
											</tr>
										</tbody></table></td>
									</tr>
								</tbody></table></td>
							</tr>
						</tbody></table></td>
					</tr><tr class="quick">
						<td class="root msg-divide"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" border="0" width="1px" height="1px" alt=""></td>
					</tr><tr class="MsgHd Rt HdUnSel " id="F2705518_h0">
						<td width="100%"><table class="quickHd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr class="hover-row">
								<td width="16px" class="Frm_MsgIndent"><a name="xx2705518xx"></a><img height="16px" width="16px" align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_general.gif" alt="General"></td><td class="Frm_MsgSubject hover-container"><a class="message-link" name="2705518" parent="0" thread="2705518" href="http://www.codeproject.com/Messages/2705518/Straight-to-the-point-article.aspx">Straight to the point article</a> <a onclick="return Pin(this);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#" title="Click to pin message"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/pin.gif" border="0" align="top" alt="Pin" width="13px" height="12px"></a></td><td class="Frm_MsgIcon"><img border="0" src="./Programmatically disable enable Windows firewall - CodeProject_files/icn-member-16.gif" title="member" alt="member" height="16px"></td><td class="Frm_MsgAuthor"><a href="http://www.codeproject.com/script/Membership/View.aspx?mid=11879">nnm</a></td><td class="Frm_MsgDate" style="vertical-align:top;white-space:nowrap;">18:55 2 Sep '08 &nbsp;</td>
							</tr>
						</tbody></table></td>
					</tr><tr id="F2705518_h1" style="display:none;">
						<td width="100%"><table class="quickBd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr>
								<td class="Frm_MsgIndent" style="width:16px;"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" height="1px" width="16px" alt=""></td><td class="MsgBd BdSel "><table border="0" cellpadding="0" cellspacing="5px" width="100%">
									<tbody><tr>
										<td><table border="0" cellpadding="0" cellspacing="0" width="100%">
											<tbody><tr>
												<td colspan="2">I like this article: straight to the point, no bloating, etc.<br>
Keep up the good work. <img src="./Programmatically disable enable Windows firewall - CodeProject_files/smiley_biggrin.gif" align="top" alt="Big Grin | :-D"> <br></td>
											</tr><tr style="vertical-align:middle;">
												<td class="msg-footer"><a class="button-newmsg" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=2705518&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=r" title="Reply">Reply</a>·<a class="toolbar" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=2705518&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=e" title="Email">Email</a>·<a class="toolbar" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall?fid=379068&tid=2705518" title="View Thread">View&nbsp;Thread</a>·<a class="toolbar" href="http://www.codeproject.com/Messages/2705518/Straight-to-the-point-article.aspx" title="Get permanent link">Permalink</a>·<a class="toolbar" href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=2705518&obtid=3&action=AddBookmark&bio=false" title="Bookmark this post" onclick="return bookmarkMe(0,0,&#39;/script/Bookmarks/Ajax/Add.aspx?obid=2705518&amp;obtid=3&amp;action=AddBookmark&amp;bio=false&#39;,false, this, this);">Bookmark</a></td><td class="msg-footer" style="text-align:right;"><span id="MVF2705518" style="white-space:nowrap;"><script type="text/javascript">
													MsgVFrm(11879,2705518,false,"","","");
												</script>Rate this message: <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2705518xx" onclick="RateMsg(11879, 2705518,1,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_down.gif" alt="vote 1" border="0" align="middle"></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2705518xx" title="vote this message a 1" onclick="RateMsg(11879, 2705518, 1,0)"><b>1</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2705518xx" title="vote this message a 2" onclick="RateMsg(11879, 2705518, 2,0)"><b>2</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2705518xx" title="vote this message a 3" onclick="RateMsg(11879, 2705518, 3,0)"><b>3</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2705518xx" title="vote this message a 4" onclick="RateMsg(11879, 2705518, 4,0)"><b>4</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2705518xx" title="vote this message a 5" onclick="RateMsg(11879, 2705518, 5,0)"><b>5</b></a> <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx2705518xx" onclick="RateMsg(11879, 2705518,5,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_up.gif" border="0" alt="vote 5" align="middle"></a> </span></td>
											</tr>
										</tbody></table></td>
									</tr>
								</tbody></table></td>
							</tr>
						</tbody></table></td>
					</tr><tr class="quick">
						<td class="root msg-divide"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" border="0" width="1px" height="1px" alt=""></td>
					</tr><tr class="MsgHd LoVote Rt HdUnSel " id="F1881647_h0">
						<td width="100%"><table class="quickHd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr class="hover-row">
								<td width="16px" class="Frm_MsgIndent"><a name="xx1881647xx"></a><img height="16px" width="16px" align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_question(1).gif" alt="Question"></td><td class="Frm_MsgSubject hover-container"><a class="message-link" name="1881647" parent="0" thread="1881647" href="http://www.codeproject.com/Messages/1881647/Why-it-dont-work.aspx">Why it don't work??</a> <a onclick="return Pin(this);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#" title="Click to pin message"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/pin.gif" border="0" align="top" alt="Pin" width="13px" height="12px"></a></td><td class="Frm_MsgIcon"><img border="0" src="./Programmatically disable enable Windows firewall - CodeProject_files/icn-member-16.gif" title="member" alt="member" height="16px"></td><td class="Frm_MsgAuthor"><a href="http://www.codeproject.com/script/Membership/View.aspx?mid=3255583">us01739</a></td><td class="Frm_MsgDate" style="vertical-align:top;white-space:nowrap;">2:45 7 Feb '07 &nbsp;</td>
							</tr>
						</tbody></table></td>
					</tr><tr id="F1881647_h1" style="display:none;">
						<td width="100%"><table class="quickBd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr>
								<td class="Frm_MsgIndent" style="width:16px;"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" height="1px" width="16px" alt=""></td><td class="MsgBd BdSel "><table border="0" cellpadding="0" cellspacing="5px" width="100%">
									<tbody><tr>
										<td><table border="0" cellpadding="0" cellspacing="0" width="100%">
											<tbody><tr>
												<td colspan="2">Hello,<br>
the code is wonderfull but I retrieve an error when I debug it in VS2005<br>
The error is:<br>
&nbsp;<br>
"There are no more endpoints available from the endpoint mapper.<br>
Exception from HRESULT: 0x800706D9"<br>
&nbsp;<br>
Can you help me to understand it?<br>
&nbsp;<br>
PS: I am sorry for my english <img src="./Programmatically disable enable Windows firewall - CodeProject_files/smiley_frown.gif" align="top" alt="Frown | :-(">  <br>
&nbsp;<br>
Roberto Gelmini - Italy<br></td>
											</tr><tr style="vertical-align:middle;">
												<td class="msg-footer"><a class="button-newmsg" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=1881647&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=r" title="Reply">Reply</a>·<a class="toolbar" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=1881647&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=e" title="Email">Email</a>·<a class="toolbar" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall?fid=379068&tid=1881647" title="View Thread">View&nbsp;Thread</a>·<a class="toolbar" href="http://www.codeproject.com/Messages/1881647/Why-it-dont-work.aspx" title="Get permanent link">Permalink</a>·<a class="toolbar" href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1881647&obtid=3&action=AddBookmark&bio=false" title="Bookmark this post" onclick="return bookmarkMe(0,0,&#39;/script/Bookmarks/Ajax/Add.aspx?obid=1881647&amp;obtid=3&amp;action=AddBookmark&amp;bio=false&#39;,false, this, this);">Bookmark</a></td><td class="msg-footer" style="text-align:right;"><span id="MVF1881647" style="white-space:nowrap;">2.33/5 (3 votes) <script type="text/javascript">
													MsgVFrm(3255583,1881647,false,"","","");
												</script>Rate this message: <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1881647xx" onclick="RateMsg(3255583, 1881647,1,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_down.gif" alt="vote 1" border="0" align="middle"></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1881647xx" title="vote this message a 1" onclick="RateMsg(3255583, 1881647, 1,0)"><b>1</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1881647xx" title="vote this message a 2" onclick="RateMsg(3255583, 1881647, 2,0)"><b>2</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1881647xx" title="vote this message a 3" onclick="RateMsg(3255583, 1881647, 3,0)"><b>3</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1881647xx" title="vote this message a 4" onclick="RateMsg(3255583, 1881647, 4,0)"><b>4</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1881647xx" title="vote this message a 5" onclick="RateMsg(3255583, 1881647, 5,0)"><b>5</b></a> <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1881647xx" onclick="RateMsg(3255583, 1881647,5,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_up.gif" border="0" alt="vote 5" align="middle"></a> </span></td>
											</tr>
										</tbody></table></td>
									</tr>
								</tbody></table></td>
							</tr>
						</tbody></table></td>
					</tr><tr class="quick">
						<td class="root msg-divide"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" border="0" width="1px" height="1px" alt=""></td>
					</tr><tr class="MsgHd LoVote Rt HdUnSel " id="F1866897_h0">
						<td width="100%"><table class="quickHd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr class="hover-row">
								<td width="16px" class="Frm_MsgIndent"><a name="xx1866897xx"></a><img height="16px" width="16px" align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_general.gif" alt="General"></td><td class="Frm_MsgSubject hover-container"><a class="message-link" name="1866897" parent="0" thread="1866897" href="http://www.codeproject.com/Messages/1866897/Another-article-on-the-same-topic.aspx">Another article on the same topic ...</a> <a onclick="return Pin(this);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#" title="Click to pin message"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/pin.gif" border="0" align="top" alt="Pin" width="13px" height="12px"></a></td><td class="Frm_MsgIcon"><img border="0" src="./Programmatically disable enable Windows firewall - CodeProject_files/icn-member-16.gif" title="member" alt="member" height="16px"></td><td class="Frm_MsgAuthor"><a href="http://www.codeproject.com/script/Membership/View.aspx?mid=534826">Tony Selke</a></td><td class="Frm_MsgDate" style="vertical-align:top;white-space:nowrap;">14:04 29 Jan '07 &nbsp;</td>
							</tr>
						</tbody></table></td>
					</tr><tr id="F1866897_h1" style="display:none;">
						<td width="100%"><table class="quickBd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr>
								<td class="Frm_MsgIndent" style="width:16px;"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" height="1px" width="16px" alt=""></td><td class="MsgBd BdSel "><table border="0" cellpadding="0" cellspacing="5px" width="100%">
									<tbody><tr>
										<td><table border="0" cellpadding="0" cellspacing="0" width="100%">
											<tbody><tr>
												<td colspan="2">For a more complete and automated implementation of the same functionality, you can refer to the article <a href="http://www.codeproject.com/vb/net/WinNetConn.asp" rel="nofollow">Using the Internet Connection Sharing (ICS) and Internet Connection Firewall (ICF) COM Interfaces</a>[<a target="_blank" title="New Window" rel="nofollow" href="http://www.codeproject.com/vb/net/WinNetConn.asp">^</a>], which exposes all of a machine's connections through a pre-loaded, strongly-typed collection.  Admittedly, this is my article from November of 2004. <img src="./Programmatically disable enable Windows firewall - CodeProject_files/smiley_wink.gif" align="top" alt="Wink | ;)">  <br></td>
											</tr><tr style="vertical-align:middle;">
												<td class="msg-footer"><a class="button-newmsg" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=1866897&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=r" title="Reply">Reply</a>·<a class="toolbar" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=1866897&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=e" title="Email">Email</a>·<a class="toolbar" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall?fid=379068&tid=1866897" title="View Thread">View&nbsp;Thread</a>·<a class="toolbar" href="http://www.codeproject.com/Messages/1866897/Another-article-on-the-same-topic.aspx" title="Get permanent link">Permalink</a>·<a class="toolbar" href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1866897&obtid=3&action=AddBookmark&bio=false" title="Bookmark this post" onclick="return bookmarkMe(0,0,&#39;/script/Bookmarks/Ajax/Add.aspx?obid=1866897&amp;obtid=3&amp;action=AddBookmark&amp;bio=false&#39;,false, this, this);">Bookmark</a></td><td class="msg-footer" style="text-align:right;"><span id="MVF1866897" style="white-space:nowrap;">2.00/5 (1 vote) <script type="text/javascript">
													MsgVFrm(534826,1866897,false,"","","");
												</script>Rate this message: <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1866897xx" onclick="RateMsg(534826, 1866897,1,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_down.gif" alt="vote 1" border="0" align="middle"></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1866897xx" title="vote this message a 1" onclick="RateMsg(534826, 1866897, 1,0)"><b>1</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1866897xx" title="vote this message a 2" onclick="RateMsg(534826, 1866897, 2,0)"><b>2</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1866897xx" title="vote this message a 3" onclick="RateMsg(534826, 1866897, 3,0)"><b>3</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1866897xx" title="vote this message a 4" onclick="RateMsg(534826, 1866897, 4,0)"><b>4</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1866897xx" title="vote this message a 5" onclick="RateMsg(534826, 1866897, 5,0)"><b>5</b></a> <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1866897xx" onclick="RateMsg(534826, 1866897,5,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_up.gif" border="0" alt="vote 5" align="middle"></a> </span></td>
											</tr>
										</tbody></table></td>
									</tr>
								</tbody></table></td>
							</tr>
						</tbody></table></td>
					</tr><tr class="quick">
						<td class="root msg-divide"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" border="0" width="1px" height="1px" alt=""></td>
					</tr><tr class="MsgHd LoVote Rt HdUnSel " id="F1864280_h0">
						<td width="100%"><table class="quickHd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr class="hover-row">
								<td width="16px" class="Frm_MsgIndent"><a name="xx1864280xx"></a><img height="16px" width="16px" align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_general.gif" alt="General"></td><td class="Frm_MsgSubject hover-container"><a class="message-link" name="1864280" parent="0" thread="1864280" href="http://www.codeproject.com/Messages/1864280/good-work.aspx">good work!</a> <a onclick="return Pin(this);" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#" title="Click to pin message"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/pin.gif" border="0" align="top" alt="Pin" width="13px" height="12px"></a></td><td class="Frm_MsgIcon"><img border="0" src="./Programmatically disable enable Windows firewall - CodeProject_files/icn-member-16.gif" title="member" alt="member" height="16px"></td><td class="Frm_MsgAuthor"><a href="http://www.codeproject.com/script/Membership/View.aspx?mid=2608314">_Tenschman</a></td><td class="Frm_MsgDate" style="vertical-align:top;white-space:nowrap;">8:04 27 Jan '07 &nbsp;</td>
							</tr>
						</tbody></table></td>
					</tr><tr id="F1864280_h1" style="display:none;">
						<td width="100%"><table class="quickBd" border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody><tr>
								<td class="Frm_MsgIndent" style="width:16px;"><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" height="1px" width="16px" alt=""></td><td class="MsgBd BdSel "><table border="0" cellpadding="0" cellspacing="5px" width="100%">
									<tbody><tr>
										<td><table border="0" cellpadding="0" cellspacing="0" width="100%">
											<tbody><tr>
												<td colspan="2">Hi,<br>
very good work, BUT I hope no script-kiddy will see your Tutorial! <img src="./Programmatically disable enable Windows firewall - CodeProject_files/smiley_cool.gif" align="top" alt="Cool | :cool:">  <br></td>
											</tr><tr style="vertical-align:middle;">
												<td class="msg-footer"><a class="button-newmsg" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=1864280&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=r" title="Reply">Reply</a>·<a class="toolbar" href="http://www.codeproject.com/script/Forums/Edit.aspx?fid=379068&select=1864280&floc=/Articles/17309/Programmatically-disable-enable-Windows-firewall&action=e" title="Email">Email</a>·<a class="toolbar" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall?fid=379068&tid=1864280" title="View Thread">View&nbsp;Thread</a>·<a class="toolbar" href="http://www.codeproject.com/Messages/1864280/good-work.aspx" title="Get permanent link">Permalink</a>·<a class="toolbar" href="http://www.codeproject.com/script/Bookmarks/Add.aspx?obid=1864280&obtid=3&action=AddBookmark&bio=false" title="Bookmark this post" onclick="return bookmarkMe(0,0,&#39;/script/Bookmarks/Ajax/Add.aspx?obid=1864280&amp;obtid=3&amp;action=AddBookmark&amp;bio=false&#39;,false, this, this);">Bookmark</a></td><td class="msg-footer" style="text-align:right;"><span id="MVF1864280" style="white-space:nowrap;">2.00/5 (1 vote) <script type="text/javascript">
													MsgVFrm(2608314,1864280,false,"","","");
												</script>Rate this message: <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1864280xx" onclick="RateMsg(2608314, 1864280,1,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_down.gif" alt="vote 1" border="0" align="middle"></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1864280xx" title="vote this message a 1" onclick="RateMsg(2608314, 1864280, 1,0)"><b>1</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1864280xx" title="vote this message a 2" onclick="RateMsg(2608314, 1864280, 2,0)"><b>2</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1864280xx" title="vote this message a 3" onclick="RateMsg(2608314, 1864280, 3,0)"><b>3</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1864280xx" title="vote this message a 4" onclick="RateMsg(2608314, 1864280, 4,0)"><b>4</b></a> <a class="toolbar nav-link" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1864280xx" title="vote this message a 5" onclick="RateMsg(2608314, 1864280, 5,0)"><b>5</b></a> <a href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall#xx1864280xx" onclick="RateMsg(2608314, 1864280,5,0);"><img height="14px" width="14px" src="./Programmatically disable enable Windows firewall - CodeProject_files/thumbs_up.gif" border="0" alt="vote 5" align="middle"></a> </span></td>
											</tr>
										</tbody></table></td>
									</tr>
								</tbody></table></td>
							</tr>
						</tbody></table></td>
					</tr><tr>
						<td><img src="./Programmatically disable enable Windows firewall - CodeProject_files/t(2).gif" border="0" width="1px" height="5px" alt=""></td>
					</tr>
				</tbody></table></td>
			</tr><tr>
				<td><table width="100%" cellpadding="2px" cellspacing="0">
					<tbody><tr class="forum-footer">
						<td>Last Visit: 6:07 26 May '12  &nbsp; &nbsp; Last Update: 3:09 26 May '12 </td><td class="nav-link" style="text-align:right;white-space:nowrap;"><input id="_mbnUrl" type="hidden" value="/Articles/17309/Programmatically-disable-enable-Windows-firewall?fid=379068&amp;fr=13"><b>1</b></td>
					</tr>
				</tbody></table></td>
			</tr>
		
	</tbody></table>
</div><p class="small-text"><img align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_general.gif" width="16px" height="16px" alt="General"> General &nbsp;&nbsp; <img align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_news.gif" width="16px" height="16px" alt="News"> News &nbsp;&nbsp; <img align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_idea.gif" width="16px" height="16px" alt="Suggestion"> Suggestion &nbsp;&nbsp; <img align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_question(1).gif" width="16px" height="16px" alt="Question"> Question &nbsp;&nbsp; <img align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_bug.gif" width="16px" height="16px" alt="Bug"> Bug &nbsp;&nbsp; <img align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_answer.gif" width="16px" height="16px" alt="Answer"> Answer &nbsp;&nbsp; <img align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_joke.gif" width="16px" height="16px" alt="Joke"> Joke &nbsp;&nbsp; <img align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_rant.gif" width="16px" height="16px" alt="Rant"> Rant &nbsp;&nbsp; <img align="top" src="./Programmatically disable enable Windows firewall - CodeProject_files/msg_admin.gif" width="16px" height="16px" alt="Admin"> Admin &nbsp;&nbsp; </p><p class="small-text">Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.</p>

					
					<div class="theme1-background" style="height:2px"></div>

					<div class="extended tiny-text">
						<div class="row">
							<div class="float-left">
								<a id="ctl00_PermaLink" href="./Programmatically disable enable Windows firewall - CodeProject_files/Programmatically disable enable Windows firewall - CodeProject.htm">Permalink</a> | 
								<a id="ctl00_AdvertiseLink" href="http://lakequincy.com/">Advertise </a> |
								<a id="ctl00_PrivacyLink" href="http://www.codeproject.com/info/privacy.aspx">Privacy</a> |
								<a id="ctl00_Mobile" rel="nofollow" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall?display=Mobile">Mobile</a>
								<br>
								
								Web04 |
								2.5.120517.1 |
								Last Updated 24 Jan 2007								
							</div>
							<div class="float-right align-right">
								Article Copyright 2007 by petersunde<br>Everything else
								Copyright © <a href="mailto:webmaster@codeproject.com">CodeProject</a>, 1999-2012 <br>
								<a id="ctl00_TermsOfUseLink" href="http://www.codeproject.com/info/TermsOfUse.aspx">Terms of Use</a>
							</div>

							


<div class="page-width">
Layout: <a id="ctl00_PageWidth_FixedT" title="Fixed width layout" rel="nofollow" class=" active" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall?PageFlow=FixedWidth">fixed</a>
|
<a id="ctl00_PageWidth_FluidT" title="Fluid layout" rel="nofollow" href="http://www.codeproject.com/Articles/17309/Programmatically-disable-enable-Windows-firewall?PageFlow=Fluid">fluid</a>
</div>



						</div>
					</div>
					

				<br clear="all">
		
				
				</div>

				<div id="ctl00_ContentSide" class="text-sidebar">
					

					

					

					
<div class="announce">

<div class="announce-content">

<div>Hot News: <a id="ctl00_News_News_ctl01_Link" href="http://www.neowin.net/news/windows-8-boots-too-quickly-first-world-os-problem">Windows 8 boots too quickly, first world OS problem</a></div>

The Code Project Insider. <a id="ctl00_News_News_ctl02_Subscribe" href="http://www.codeproject.com/Feature/Insider/">Free each morning.</a>
</div>
</div>

						
					<div style="width:160px;margin: 10px 0;">
						<div class="lqm_ad" lqm_publisher="lqm.codeproject.site" lqm_zone="ros" lqm_format="160x600" lqm_tags="VB, Windows, .NET, Visual-Studio, Dev, Intermediate,rating4"><iframe id="lqmad4" width="160" height="600" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe></div>
					</div>

					
	<div class="announce">
	<div id="ctl00_RelatedArticles_RelatedResults_ctl00_header" class="announce-header">Related Articles</div>
	<div class="announce-content">	
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl01_Link" class="title" href="http://www.codeproject.com/KB/IP/drvfltip.aspx">Developing Firewalls for Windows 2000/XP</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl02_Link" class="title" href="http://www.codeproject.com/KB/winsdk/WinXPSP2Firewall.aspx">Windows XP SP2 Firewall Controller</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl04_Link" class="title" href="http://www.codeproject.com/KB/aspnet/FirewallSetupAction.aspx">Open Windows Firewall During Installation</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl05_Link" class="title" href="http://www.codeproject.com/KB/vista-security/VistaFirewallNet.aspx">The managed classes to read Windows Firewall configuration on Vista using Advanced Security Interfaces</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl06_Link" class="title" href="http://www.codeproject.com/KB/dotnet/dynamic_firewall_api.aspx">The 'dynamic' keyword for higher productivity: Windows Firewall API example</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl07_Link" class="title" href="http://www.codeproject.com/KB/cpp/firewallpapi.aspx">An Easy Firewall Application</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl08_Link" class="title" href="http://www.codeproject.com/KB/IP/PacketFilter.aspx">Firewall using Vista's Windows Filtering Platform APIs</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl09_Link" class="title" href="http://www.codeproject.com/KB/winsdk/Antifirewall.aspx">How to enable and disable Windows XP SP2 firewall, programmatically</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl10_Link" class="title" href="http://www.codeproject.com/KB/IP/firewall_sniffer.aspx">Internet Traffic Firewall and Sniffer</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl11_Link" class="title" href="http://www.codeproject.com/KB/IP/smfirewall.aspx">Simple Packet - Filter Firewall</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl12_Link" class="title" href="http://www.codeproject.com/KB/threads/A_not_so_simple_firewall.aspx">A not so simple firewall.</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl13_Link" class="title" href="http://www.codeproject.com/KB/DLL/ReplaceWindowsSocketsDLLs.aspx">Proxy WS2_32.DLL to create your own firewall</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl14_Link" class="title" href="http://www.codeproject.com/KB/IP/BinaryThroughFirewalls.aspx">XML Serialization and Firewalls</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl15_Link" class="title" href="http://www.codeproject.com/KB/IP/Firewall_NET_C_.aspx">Useful Lite Effective Firewall .NET</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl16_Link" class="title" href="http://www.codeproject.com/KB/IP/POP3ClientOverFirewall.aspx">POP3 Client Over Firewall</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl17_Link" class="title" href="http://www.codeproject.com/KB/security/xpsecuritycenter.aspx">Software Development: Build your own Windows Security Center</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl18_Link" class="title" href="http://www.codeproject.com/KB/IP/WinNetConn.aspx">Using the Internet Connection Sharing (ICS) and Internet Connection Firewall (ICF) COM Interfaces</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl19_Link" class="title" href="http://www.codeproject.com/KB/showcase/SecuringWebServices.aspx">Securing XML Web Services: XML Firewalls and XML VPNs</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl20_Link" class="title" href="http://www.codeproject.com/KB/cs/samer_aspx.aspx">Windows XP Security Center</a>
		
	</div>
	
	<div class="container-related-item">
		<a id="ctl00_RelatedArticles_RelatedResults_ctl21_Link" class="title" href="http://www.codeproject.com/KB/IP/OnionRouting.aspx">Access proxy / firewall restricted internet sites using tunelling or onion routing</a>
		
	</div>
	
	</div>
	</div>
	


					

				</div>

			</div>
			

		</div>
		

	</div>
</div>


<div style="display:none;" id="lqm_AdTable">
	
</div>

<script type="text/javascript" language="Javascript" src="./Programmatically disable enable Windows firewall - CodeProject_files/jquery.min.js"></script><script type="text/javascript">//<![CDATA[
if (typeof jQuery == 'undefined') {
    document.write(unescape("%3Cscript src='/script/JS/jquery-1.6.2.min.js' type='text/javascript' %3E%3C/script%3E"));
}//]]></script>
<script type="text/javascript" language="Javascript" src="./Programmatically disable enable Windows firewall - CodeProject_files/article.min.js"></script>
<script type="text/javascript" language="Javascript" src="./Programmatically disable enable Windows firewall - CodeProject_files/navbar.min.js"></script>
<script type="text/javascript" language="Javascript" src="./Programmatically disable enable Windows firewall - CodeProject_files/m.min.js"></script>
<script type="text/javascript" language="Javascript">//<![CDATA[
function markAllText(){
 markTextInElement('Windows','contentdiv');
 markTextInElement('Firewall','contentdiv');
}
$(function(){markAllText()});
var socialLinks = new social();
socialLinks.PlaceholderId="ATD";socialLinks.ObjectId=17309;
socialLinks.ObjectTypeId=2;
socialLinks.addtoMethod=1;
socialLinks.Horizontal=false;
socialLinks.Showname=true;
socialLinks.setupLinks("socialLinks", escape(document.location.href),escape(document.title), 100, 0, "small-text Bold", "AddTo");
socialLinks.setupMenu();
$(document).ready(function() {   $('.alert-bar').slideDown('fast');   $('.alert-bar a.close-notify').click(function() {      $('.alert-bar').slideUp('fast');        return false;    });});
if($.LqmAds)$.LqmAds();
var oSrchFlt = false, oSrchBox=false,srchBoxFoc=false;
$(document).ready(function() {
 if(InitWatermark)InitWatermark('sb_tb', 'Search site');
 var sbar = $('#sb_tb'); 
 var sfilter = $('#SearchFilter');
 if (sbar && sfilter) {
  sfilter.removeClass('popup'); sfilter.hide();
  sbar.blur(function() { if (!oSrchFlt)sfilter.hide();srchBoxFoc=false; });
  sbar.focus(function() { oSrchFlt=false;srchBoxFoc=true;sfilter.show(); });
  sbar.mouseleave(function() { oSrchBox=false; });
  sbar.mouseover(function() { oSrchBox=true; });
  sfilter.mouseleave(function() { oSrchFlt=false; if (!srchBoxFoc&&!oSrchBox)sfilter.hide();});
  sfilter.mouseover(function() { oSrchFlt=true; });
 }
});
$(document).ready(function() { anchorAnimate(); });
var reportingMemberId = 8126139;
$("#ctl00_RateArticle_RateItemWrapper").removeClass("container-rating");$('#clear-rate_ctl00_RateArticle_RCD').click(function () { $('#ctl00_RateArticle_RCD').hide(); return false;});
function PostBack_ctl00_RateArticle_RateItemWrapper() {
  return rateItem(17309,2,1,true,true,3);
}
function ChkRtctl00_RateArticle(val, objId) {if (val<=3||true) {
$('div[name=RateItem_' + objId + '] .rating-comment').css("display","");}
else $('div[name=RateItem_' + objId + '] .rating-comment').css("display","none");}


//]]>
</script>



<canvas id="cv1" width="1px" height="1px" style="position:absolute;left:0;top:0;pointer-events:none"></canvas><canvas id="cv2" width="1px" height="1px" style="position:absolute;left:0;top:0;pointer-events:none"></canvas></body></html>